How do I access bottle development server from another PC on the LAN?

Ted W. picture Ted W. · Feb 19, 2013 · Viewed 9.2k times · Source

I'm running the bottle.py tutorial on one PC, and I was able to access it using

http://localhost:8080/hello/world

However, when I tried to access it (IP address is 192.168.1.10) from another PC on the LAN, using

http://192.168.1.10:8080/hello/world

I received the "Cannot Open Page" error.

I have the Apache web server running on the PC, and I can access the web server without any problem using

http://192.168.1.10

Any suggestions? Thanks.

Answer

Johnsyweb picture Johnsyweb · Feb 19, 2013

Assuming you're talking about the Quickstart: “Hello World” example:

Change this line:

run(host='localhost', port=8080, debug=True)

To bind to the public IPv4 address of your computer:

run(host='192.168.1.10', port=8080, debug=True)

Or to this to listen on all interfaces including the external one [Source: bottle.run, Bottle API Reference]:

run(host='0.0.0.0', port=8080, debug=True)

Then you should be able to access http://192.168.1.10:8080/hello/world from your local PC as well as another PC on the LAN. Alternatively use a Fully Qualified Domain Name (FQDN).

If connections are still refused, check your firewall settings.