Django运行访问项目出现的问题:DisallowedHost at / Invalid HTTP_HOST header:
DisallowedHost at /
Invalid HTTP_HOST header: '10.211.55.6:8000'. You may need to add u'10.211.55.6' to ALLOWED_HOSTS.
Request Method:GET
Request URL:http://10.211.55.6:8000/
Django Version:1.10.4
Exception Type:DisallowedHost
Exception Value:Invalid HTTP_HOST header: '10.211.55.6:8000'. You may need to add u'10.211.55.6' to ALLOWED_HOSTS.
Exception Location:/usr/lib/python2.7/site-packages/django/http/request.py in get_host, line 113
Python Executable:/usr/bin/python
Python Version:
在云服务器启动一个Django的项目发现报了这个错。
解决办法是:在Django项目下的settings.py里面修改
ALLOWED_HOSTS=['*'] *代表允许所有的主机
如下图: