我如何从局域网上的另一台电脑访问瓶子的开发服务器?[英] How do I access bottle development server from another PC on the LAN?

本文是小编为大家收集整理的关于我如何从局域网上的另一台电脑访问瓶子的开发服务器?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在一台PC上运行瓶子.

http://localhost:8080/hello/world

但是,当我尝试从LAN上的另一台PC上访问它(IP地址为192.168.1.10)时,使用

http://192.168.1.10:8080/hello/world

我收到了"无法打开的页面"错误.

我在PC上运行Apache Web服务器,我可以使用

访问Web服务器
http://192.168.1.10

有什么建议吗?谢谢.

推荐答案

假设您在谈论 QuickStart "> QuickStart "> QuickStart:世界" 示例:

更改此行:

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

绑定到计算机的公共IPv4地址:

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

或对此聆听所有接口,包括外部一个[ source : bottle.run,瓶API参考]:

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

然后,您应该能够从本地PC以及LAN上的另一台PC访问http://192.168.1.10:8080/hello/world.或者使用完全合格的域名(FQDN).

如果仍然拒绝连接,请检查您的防火墙设置.

本文地址:https://www.itbaoku.cn/post/1975349.html

问题描述

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.

推荐答案

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.