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

荒凉一梦 提交于 2019-12-04 17:24:44

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/14958597/how-do-i-access-bottle-development-server-from-another-pc-on-the-lan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!