http_host头文件无效 [英] Invalid http_host header

查看:374
本文介绍了http_host头文件无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Django框架开发一个网站,并使用DigitalOcean.com启动并将必要的文件部署到django-project中。



我不得不包含静态文件进入Django项目并收集静态文件后,我尝试刷新我的ip



我正在包括我用来创建网站的教程。
https://www.pythonprogramming.net/django-web-server-publish-tutorial /



我收到以下错误:
DisallowedHost at / Invalid HTTP_HOST header:'198.211.99.20'。您可能需要将u'198.211.99.20'添加到ALLOWED_HOSTS。



有人可以帮我解决这个问题吗?这是我第一个使用Django框架的网站。

解决方案

错误日志很简单。根据建议,您需要将 198.211.99.20 添加到您的ALLOWED_HOSTS设置。



在您的项目settings.py文件中,将此设置为ALLOWED_HOSTS :

  ALLOWED_HOSTS = ['198.211.99.20','localhost','127.0.0.1'] 

要进一步阅读,
从这里阅读。


I am trying to develop a website using Django framework and launched using DigitalOcean.com and deployed the necessary files into django-project.

I had to include static files into Django-project and After collecting static files, I tried to refresh my ip

I am including the tutorials which I have used to create the website. https://www.pythonprogramming.net/django-web-server-publish-tutorial/

I am getting the following error : DisallowedHost at / Invalid HTTP_HOST header: '198.211.99.20'. You may need to add u'198.211.99.20' to ALLOWED_HOSTS.

Can somebody help me to fix this ? This is my first website using Django framework.

解决方案

The error log is straightforward. As it suggested,You need to add 198.211.99.20 to your ALLOWED_HOSTS setting.

In your project settings.py file,set ALLOWED_HOSTS like this :

ALLOWED_HOSTS = ['198.211.99.20', 'localhost', '127.0.0.1']

For further reading, Read from here.

这篇关于http_host头文件无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆