6👍
✅
Have you started the server like this?
python manage.py runserver 0.0.0.0:8000
Then, try to connect to 192.168.XXX.XXX:8000
2👍
I tried the above, but failed to work in my case. Then with running
python manage.py runserver 0.0.0.0:8000 I also had to add my IP to ALLOWED_HOSTS in settings.py, which solved this issue.
eg.
Add your ip to allowed hosts in settings.py
ALLOWED_HOSTS = [‘192.168.XXX.XXX’]
Then run the server
python manage.py runserver 0.0.0.0:8000
- [Django]-Django Rest Serializer returns empty
- [Django]-How would I write a CSV file populated with my sqlite3 db?
- [Django]-Python UnicodeEncodeError, but I have encoded the parameters to UTF-8
0👍
Others have already given the answer but those solutions didn’t work for me when I was running Django server on Ubuntu and was trying to access it from my Mobile app.
Following is what worked for me:
Step 1: Run server to access it from your IP
python manage.py runserver 0.0.0.0:8000
Step 2: Open port in firewall (Missing step in above given answers – Needed for Ubuntu)
$ sudo ufw enable
$ sudo ufw allow 8000
- [Django]-Django get the max PK
- [Django]-What is fuzzy strings in gettext?
- [Django]-How would you write an `is_pdf(path_to_file)` function in Python?
- [Django]-How to calculate execution time of a view in Django?
Source:stackexchange.com