Denied host in Django

I am just starting with Django for the first time. So I create a django project and run the command

python3  manage.py  runserver  0.0.0.0:8000

Instead of getting the expected django homepage, I get the following error message,

DisallowedHost at /
Invalid HTTP_HOST header: '0.0.0.0:8000'. You may need to add '0.0.0.0' to ALLOWED_HOSTS.
Request Method: GET
Request URL:    http://0.0.0.0:8000/
Django Version: 1.10.5
Exception Type: DisallowedHost
Exception Value:    
Invalid HTTP_HOST header: '0.0.0.0:8000'. You may need to add '0.0.0.0' to ALLOWED_HOSTS.
Exception Location: /usr/local/lib/python3.5/site-packages/django/http/request.py in get_host, line 113
Python Executable:  /usr/local/opt/python3/bin/python3.5
Python Version: 3.5.2

I haven't scratched the django surface yet, so it would be helpful to help how to fix this?

+4
source share
1 answer

literally, as the error suggests! forward and add a line

0.0.0.0in ALLOWED_HOSTinsettings.py

I mean, the error information is pretty clear. Why don't you try. This should fix the problem right away.

+9
source

Source: https://habr.com/ru/post/1667312/


All Articles