Disallowed Host at Django

literally as the error suggested! go ahead and add the line

0.0.0.0 to the ALLOWED_HOSTS in your settings.py

The error info is quite explicit. It should solve the problem right away.


1- run

ifconfig check you ip address, and you should add the ip to this lone: ALLOWED_HOSTS =['you IP address goes here']

2- run:

python manage.py your-ip:8000

3- go to your browser and check you ip:8000

enter image description here

enter image description here


I too had problems with this and it is not easy for a beginner to fix. Here below is the sequence required:

First find your settings.py file, which is located:

projectName/projectName/settings.py

You can also find it using: find -name "settings.py" - likely you will have only one!

Once you have found this, you need to open it in a text editor and change the line

ALLOWED_HOSTS =[ ] to ALLOWED_HOSTS =['your.host.ip.address'] - include the ' ' and the [ ] then save. You will have to re-start the server to get this to work eg:

   python manage.py runserver your.host.ip.address:8000

If you get a syntax error, make sure you have something that looks like:

ALLOWED_HOSTS =['192.168.1.200'] or whatever your ip address is.

Tags:

Python

Django