Running the Django project appears invalid Http_host header: ' 192.168.1.111:8000 '. Need to add ' 192.168.1.111 ' to allowed_hosts

Source: Internet
Author: User

Request Method: GET
Request URL: Http://202.201.38.70:8000/angular
Django Version: 1.11.3
Exception Type: Disallowedhost
Exception Value:
Invalid http_host Header: ' 202.201.38.70:8000 '. Need to add ' 202.201.38.70 ' to allowed_hosts.
Exception Location: /usr/local/python3/lib/python3.6/site-packages/django-1.11.3-py3.6.egg/django/http/request.py in Get_host, line 113
Python executable: /usr/local/python3/bin/python3
Python Version: 3.6.1
Python Path:
['/var/www/html/application/mysite ', '/usr/local/python3/lib/python36.zip ', '/usr/local/python3/lib/python3.6 ', ' /usr/local/python3/lib/python3.6/lib-dynload ', '/usr/local/python3/lib/python3.6/site-packages ', '/usr/local/ Python3/lib/python3.6/site-packages/django-1.11.3-py3.6.egg ', '/usr/local/python3/lib/python3.6/site-packages/ Pytz-2017.2-py3.6.egg ', '/usr/local/python3/lib/python3.6/site-packages/pymysql-0.7.11-py3.6.egg ', '/usr/local/ Python3/lib/python3.6/site-packages/django_tokenapi-1.0-py3.6.egg ', '/usr/local/python3/lib/python3.6/ Site-packages/xlrd-1.0.0-py3.6.egg ', '/usr/local/python3/lib/python3.6/site-packages/python_ Dateutil-2.6.1-py3.6.egg ', '/usr/local/python3/lib/python3.6/site-packages/six-1.10.0-py3.6.egg ']
Server Time: Tue, 2017 09:56:31 +0000

When you run the project, enter command #Python manage.py runserver 192.168.1.111:8000, enter HTTP///192.168.1.111:8000 in the native browser

Modify the setting.py file in the project we created

allowed_hosts = [' * '] # Here The requested host has been added *

Running the Django project appears invalid Http_host header: ' 192.168.1.111:8000 '. Need to add ' 192.168.1.111 ' to allowed_hosts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.