Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing django localhost server through lan

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.

like image 531
Atishay Avatar asked Nov 29 '22 00:11

Atishay


1 Answers

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.

enter image description here

like image 70
Vikash Singh Avatar answered Dec 06 '22 02:12

Vikash Singh