I'm developing for web and I have a prototype of my website. For testing locally I usually do
python3 -m http.server
and then go to localhost:8000
on my browser. This works great!
Then I read on the internet I could figure my private IPv4 IP address (10.0.0.101 as per ipconfig
) and run
10.0.0.101:8000
on my phone's browser to access my website.
Thing is when I do this I get an "This site can't be reached (ERR_CONNECTION_TIMED_OUT)".
My network config
Between my ISP modem and my devices I have an router (D-Link DIR-815). An ethernet cable connects the router to my desktop computer and my phone is connected via Wi-Fi.
What I've tried
I've tried all items below and a lot of combinations between them (but unlikely all of the combinations because there are too many)
- Using chrome inside the Bluestacks emulator
- Forwarding the port 8000 on my router and using
<my_public_ip>:8000
- adding a firewall exception for the 8000 port (both TCP and UDP)
- using
10.0.0.101:8000
on my desktop browser- I did it just for testing and it came as a surprise for me that this didn't work!
- using
127.0.0.1:8000
on my desktop browser (just for testing)- That didn't work. Which came as an even bigger surprise for me.
The Question
What am I missing here? Why can't I access my localhost from my phone?
I've read many question including this one which contains many answer and was the top result on google. Bug the thing is both for the sake of simplicity of using only python and for my education I want to know how can I do this without installing more complex solutions like XAMPP.
PS:
- Also I know it is possible because it is shown in this video.
- I double checked my private IPv4 IP in my router (
dlinkrouter.local
)