Unable to access django app on other android devices on my hotspot network
Question:
I created the django app and hosted the same on my laptop which was connected to my android mobile hotspot.
Then I got the IP of my machine, using ipconfig
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::2d4e:f2c4:bc88:e67e%5
IPv4 Address. . . . . . . . . . . : 192.168.43.69
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.43.1
then I added the same to
ALLOWED_HOSTS = ['192.168.43.69']
and ran the server using
python manage.py runserver 192.168.43.69:8000
now when I am accessing the same on my laptop, I am able to access the device but when I am trying to access the same on my mobile device I am getting the same typical chrome connection error
The site can't be reached
192.168.43.69 took too long to respond
ERR_CONNCTION_TIMED_OUT
How can I resolve the same?
Answers:
you should run the server by using
python manage.py runserver 0.0.0.0:8000
That way only you can access it from outside host. You still can use your host ip address to access the application.
ie: 192.168.43.69
Here is what I found with the help of Himanshuman’s and Yasii’s answers.
I got things work for me i am mentioning below:
-
get you IP address using ipconfig
-
Add this IPV4 IP address to the ALLOWED_HOSTS list in setting.py
-
turn off the firewall on you system from settings.
-
Next step is try running the localhost using python manage.py runserver 0.0.0.0:8000
-
Now go to phone and type yourIP:8000 and your project will run in your phone.
For example 192.168.45.100:8000 will run the localhost in your phone.
This is how things worked for me. steps are in cronological order and recommended to be executed one after another
I created the django app and hosted the same on my laptop which was connected to my android mobile hotspot.
Then I got the IP of my machine, using ipconfig
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::2d4e:f2c4:bc88:e67e%5
IPv4 Address. . . . . . . . . . . : 192.168.43.69
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.43.1
then I added the same to
ALLOWED_HOSTS = ['192.168.43.69']
and ran the server using
python manage.py runserver 192.168.43.69:8000
now when I am accessing the same on my laptop, I am able to access the device but when I am trying to access the same on my mobile device I am getting the same typical chrome connection error
The site can't be reached
192.168.43.69 took too long to respond
ERR_CONNCTION_TIMED_OUT
How can I resolve the same?
you should run the server by using
python manage.py runserver 0.0.0.0:8000
That way only you can access it from outside host. You still can use your host ip address to access the application.
ie: 192.168.43.69
Here is what I found with the help of Himanshuman’s and Yasii’s answers.
I got things work for me i am mentioning below:
-
get you IP address using ipconfig
-
Add this IPV4 IP address to the ALLOWED_HOSTS list in setting.py
-
turn off the firewall on you system from settings.
-
Next step is try running the localhost using python manage.py runserver 0.0.0.0:8000
-
Now go to phone and type yourIP:8000 and your project will run in your phone.
For example 192.168.45.100:8000 will run the localhost in your phone.
This is how things worked for me. steps are in cronological order and recommended to be executed one after another