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

2023-05-16编程技术14375

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=['*']        *代表允许所有的主机

如下图:

Django运行访问项目出现的问题:DisallowedHost at / Invalid HTTP_HOST header的相关教程结束。

本文地址:https://www.ufcn.cn/tutorials/2643642.html

如非特殊说明,本站内容均来自于网友自主分享,概不代表本站观点,如有任何问题我们都将在收到反馈后的第一时间进行处理!