Reputation: 63
I have a django server running on my PC. I want to access the server through my android phone.How can I do that? I tried running
python manage.py runserver 0.0.0.0:8000.
After this, I can access server from my pc through PC's ip address, but not accessible through other device coonected to same wifi.
Upvotes: 5
Views: 11203
Reputation: 31
In your terminal run
ipconfig
and find the IPv4 address ,and if you are using Django go to settings.py and in the ALLOWED_HOST add the IPv4 address in the list.
In my case
ALLOWED_HOSTS = ['192.168.30.81', '127.0.0.1', '0.0.0.0', '192.168.167.206']
then run ( in my case )
python manage.py runserver 192.168.167.206:8000
Upvotes: 2
Reputation: 11
A related issue I ran into was in relation to this error:
"code 400, message Bad HTTP/0.9 request type ('\***\***\***\***\***\***\***\***\***') [time stamp] You're accessing the development server over HTTPS, but it only supports HTTP"
Just verify that this is the reason you are not able to view also. Of course you would see this in your server messages if so.
Upvotes: 0
Reputation: 14011
you need to do these steps
1. run python manage.py runserver 0.0.0.0:8000
2. figure out your ip address which is say 192.168.1.8
3. Add '192.168.1.8' to ALLOWED_HOSTS list in your settings.py file.
4. access 192.168.1.8:8000 on mobile.
I tried this, its working for me.
Upvotes: 19
Reputation: 665
can you try it python manage.py runserver youripadress:8000
[python manage.py runserver 192.168.0.1:8000
]
Upvotes: 5