45👍
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.
8👍
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.
- [Django]-Handlebars.js in Django templates
- [Django]-Difference between Django Form 'initial' and 'bound data'?
- [Django]-How to completely uninstall a Django app?
1👍
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
- [Django]-Django self-recursive foreignkey filter query for all childs
- [Django]-How to compare two JSON objects with the same elements in a different order equal?
- [Django]-Replace textarea with rich text editor in Django Admin?
1👍
Just close the postman and try request in new tab. This worked for me.
- [Django]-How do I include image files in Django templates?
- [Django]-How to stream an HttpResponse with Django
- [Django]-What is a "django backend"?
0👍
1.You can also find it using: find -name “SETTINGS.py” – likely you will have only one!
2.Once you have found this, you need to open it in a text editor and change the line in the insetting File
ALLOWED_HOSTS =['Your_compte_pythonanywher.pythonanywhere.com']
- [Django]-Right way to return proxy model instance from a base model instance in Django?
- [Django]-How to update user password in Django Rest Framework?
- [Django]-Rerun a Django data migration
0👍
Additionally, you can have a file local_settings.py and settings.py.
If you are running in a local or a VPS server considered as local server:
python manage.py runserver 0.0.0.0:8001
You need to add in local_settings.py
Also you can search how many ALLOWED_HOSTS has your code with:
grep -rin ALLOWED_HOSTS your_source_path
- [Django]-How to require login for Django Generic Views?
- [Django]-Access instance passed to ModelForm from clean(self) method
- [Django]-Starting Celery: AttributeError: 'module' object has no attribute 'celery'