Pigna February 2016

SimpleHTTPServer: other devices can't connect to the server

Lately I've been playing with Python to discover its potential and I've just stumbled upon SimpleHTTPServer.

I'm on Windows 10.

I run:

python -m SimpleHTTPServer

the output is:

Serving HTTP on 0.0.0.0 port 8000 ... 

I've opened the browser both on smartphone and tablet, but none of them can connect to the server when I type "http://127.0.0.1:8000".

(Translating from italian, maybe is not the exact translation)

iPad: "Safari can't open the page because the server has stopped responding"

Android: "WebPage does not respond. the webpage may be temporarily not available or it could have been moved to another address"

Why does it not work? How do I fix this?

Answers


James Scholes February 2016

127.0.0.1 is always the IP address of the local system (its associated hostname is "localhost"). In other words, if you type 127.0.0.1:8000 on your tablet or Android device, the browser on that device will try to connect to a server running on the same device, listening on port 8000. You'll need to find out the IP address of the computer you're running Python on, and type that instead. You can use the ifconfig command on Unix, or ipconfig on Windows.

Post Status

Asked in February 2016
Viewed 1,990 times
Voted 8
Answered 1 times

Search




Leave an answer