web端错误现象:

DisallowedHost at /

Invalid HTTP_HOST header: 'ip:8000'. You may need to add u'ip' to ALLOWED_HOSTS.
Request Method: GET
Request URL: http://ip:8000/
Django Version: 1.10.8
Exception Type: DisallowedHost
Exception Value:
Invalid HTTP_HOST header: 'ip:8000'. You may need to add u'ip' to ALLOWED_HOSTS.
Exception Location: /usr/lib/python2.7/site-packages/Django-1.10.8-py2.7.egg/django/http/request.py in get_host, line 113
Python Executable: /usr/bin/python
Python Version: 2.7.5
Python Path:
['/root/mysite',
'/usr/lib/python2.7/site-packages/requests-2.18.4-py2.7.egg',
'/usr/lib/python2.7/site-packages/certifi-2017.11.05-py2.7.egg',
'/usr/lib/python2.7/site-packages/urllib3-1.22-py2.7.egg',
'/usr/lib/python2.7/site-packages/idna-2.6-py2.7.egg',
'/usr/lib/python2.7/site-packages/chardet-3.0.4-py2.7.egg',
'/usr/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg',
'/usr/lib/python2.7/site-packages/Django-1.10.8-py2.7.egg',
'/usr/lib64/python27.zip',
'/usr/lib64/python2.7',
'/usr/lib64/python2.7/plat-linux2',
'/usr/lib64/python2.7/lib-tk',
'/usr/lib64/python2.7/lib-old',
'/usr/lib64/python2.7/lib-dynload',
'/usr/lib64/python2.7/site-packages',
'/usr/lib/python2.7/site-packages']
Server time: Sun, 24 Dec 2017 14:07:20 +0000

服务器端错误现象:

解决方法:

修改settings.py这个文件里面的配置文件:

在ALLOWED_HOSTS = ['']里面的中括号里面添加*,如下。

ALLOWED_HOSTS = ['*']

保存退出,刷新web页面即可

Django运行项目时候出现DisallowedHost at / Invalid HTTP_HOST header:的更多相关文章

  1. Django运行访问项目出现的问题:DisallowedHost at / Invalid HTTP_HOST header

    Django运行访问项目出现的问题:DisallowedHost at / Invalid HTTP_HOST header: DisallowedHost at / Invalid HTTP_HOS ...

  2. 访问Django项目出现DisallowedHost at / Invalid HTTP_HOST header问题

    闲来无事,想玩玩django,源码安装碰到了一堆乱七八糟依赖性问题,耗费一下午的时间总算是在ubuntu14.04上搭建好了python3+django2开发环境, 心血来潮,创建了一个django项 ...

  3. 运行django项目出现Invalid HTTP_HOST header: '192.168.1.111:8000'. You may need to add '192.168.1.111' to ALLOWED_HOSTS

    Request Method: GET Request URL: http://202.201.38.70:8000/angular Django Version: 1.11.3 Exception ...

  4. Django运行访问项目出现的问题:Invalid HTTP_HOST header: '192.168.114.25:8001'. You may need to add u'192.168.114.25' to ALLOWED_HOSTS.

    当运行python manage.py runserver 0.0.0.0:8001时候,出现Invalid HTTP_HOST header: '192.168.114.25:8001'. You ...

  5. django error: DisallowedHost: Invalid HTTP_HOST header: ''. You may need to add u'' to ALLOWED_HOST

    测试环境: [root@nanx-lli ~]# lsb_release -aLSB Version: :core-4.1-amd64:core-4.1-noarchDistributor ID: C ...

  6. django报错解决:Invalid HTTP_HOST header: 'xxx.com'. You may need to add u'xxx.com' to ALLOWED_HOSTS.

    django版本:1.11.15 使用uwsgi+nginx运行django程序,出现报错,报错为:Invalid HTTP_HOST header: 'xxx.com:82'. You may ne ...

  7. Invalid HTTP_HOST header: 'xxx.xxx:8000'. You may need to add 'xxx.xx' to ALLOWED_HOSTS

    用python3 manage.py runserver 0.0.0.0:8000命令运行django程序后,通过浏览器访问服务器网址的8000端口,出现访问错误,报错为 Invalid HTTP_H ...

  8. 配置python+mod_wsgi+apache 时 在浏览器中访问服务器时报错:Invalid HTTP_HOST header: 'XXXXX'. You may need to add u'XXXXX' to ALLOWED_HOSTS,在setting.py中添加‘*”无效的原因

    配置python+mod_wsgi+apache 时 在浏览器中访问服务器时报错:Invalid HTTP_HOST header: 'XXXXX'. You may need to add u'XX ...

  9. Invalid HTTP_HOST header: 'xxx.xx.xxx.xxx:8000'. You may need to add 'xxx.xx' to ALLOWED_HOSTS

    Invalid HTTP_HOST header: 'xxx.xx.xxx.xxx:8000'. You may need to add 'xxx.xx' to ALLOWED_HOSTS - buk ...

随机推荐

  1. BootStrap【三、组件】

    特有标签属性 role 用于浏览器识别 aria-label 用于浏览器识别 tabIndex 用于浏览器识别 data- 自定义数据属性 图标 直接引用官方图标库中的class 官方图标库 Demo ...

  2. linux 下安装 jdk1.7

    1.官网 下载jdk7版本 地址: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-jav ...

  3. 并发编程: 生产消费模型、死锁与Rlock、线程、守护线程、信号量、锁

    一.守护进程 二.互斥锁 三.抢票 四.进程间通讯 五.进程间通讯2 一.守护进程 """ 进程间通讯的另一种方式 使用queue queue 队列 队列的特点: 先进的 ...

  4. pip报错以及指向错误

    在终端中输入无论是pip3 -V或是pip -V都指向python3 如下图所示: 然后在卸载或更新pip 时都出现了报错: 就是卸载也卸不了更新也更不了 解决报错: Traceback (most ...

  5. linux基础_关机重启注销

    1.关机重启命令 (1)shutdown shutdown -h now:表示立即关机 shutdown -h 1:表示1分钟后关机 shutdown -r  now:立即重启 (2)halt:就是直 ...

  6. pe头

    1.dos头 结构: struct _IMAGE_DOS_HEADER {     WORD e_magic;     WORD e_cblp;     WORD e_cp;     WORD e_c ...

  7. 微信小程序填坑之旅(1)-app.js中用云开发获取openid,在其他页上用app.globaldata.openid获取为空

    参考:小程序如何在其他页面监听globalData中值的变化?https://www.jianshu.com/p/8d1c4626f9a3 原因就是:app.js没执行完时,其他页已经onload了, ...

  8. http message

  9. Java源码分析-UUID

    原文链接:Little Apple's Blog 本文分析的JDK版本为1.8.0_131. UUID? UUID是Universally Unique Identifier的缩写:Java UUID ...

  10. 数据结构实验之链表七:单链表中重复元素的删除(SDUT 2122)

    #include <bits/stdc++.h> using namespace std; typedef struct node { int data; struct node* nex ...