使用Django出现的问题及解决办法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用Django出现的问题及解决办法相关的知识,希望对你有一定的参考价值。
使用Django出现的问题及解决办法
===========================================================================================
【问题一】安装好Django,并且创建好了一个项目,然后浏览器中打开时出现以下问题
DisallowedHost at /
Invalid HTTP_HOST header: ‘172.16..:8000‘. You may need to add u‘172.16.40.247‘ to ALLOWED_HOSTS.
Request Method: | GET |
---|---|
Request URL: | http://172.16..:8000/ |
Django Version: | 1.11.5 |
Exception Type: | DisallowedHost |
Exception Value: | Invalid HTTP_HOST header: ‘172.16.40.247:8000‘. You may need to add u‘172.16.40.247‘ to ALLOWED_HOSTS. |
Exception Location: | /usr/lib/python2.7/site-packages/Django-1.11.5-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/helloworld‘, ‘/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/lib64/python2.7/site-packages/psutil-5.3.1-py2.7-linux-x86_64.egg‘, ‘/usr/lib/python2.7/site-packages‘, ‘/usr/lib/python2.7/site-packages/setuptools-36.4.0-py2.7.egg‘, ‘/usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg‘, ‘/usr/lib/python2.7/site-packages/ansible-1.7.2-py2.7.egg‘, ‘/usr/lib/python2.7/site-packages/Django-1.11.5-py2.7.egg‘, ‘/usr/lib/python2.7/site-packages/pytz-2017.2-py2.7.egg‘] |
Server time: | Sat, 16 Sep 2017 04:47:28 +0000 |
【解决办法】
找项目的settings.py文件,将
ALLOWED_HOSTS = [] 修改为
ALLOWED_HOSTS = [‘*‘]
本文出自 “doublelinux” 博客,谢绝转载!
以上是关于使用Django出现的问题及解决办法的主要内容,如果未能解决你的问题,请参考以下文章
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法(转)(代码片段
Unity 使用Animation Clip(动画片段) 对Animation Rig的Rig Weight (rig权重) 进行调整,出现无法调整的问题,及解决方法