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

查看:118
本文介绍了如何从局域网上的另一台PC访问瓶子开发服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一台PC上运行bottle.py教程,并且可以使用

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

http://localhost:8080/hello/world

但是,当我尝试使用

http://192.168.1.10:8080/hello/world

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

I received the "Cannot Open Page" error.

我在PC上运行了Apache Web服务器,并且使用可以毫无问题地访问Web服务器

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

有什么建议吗?谢谢.

推荐答案

假设您正在谈论示例:

更改此行:

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

要绑定到计算机的公共IPv4地址,请执行以下操作:

To bind to the public IPv4 address of your computer:

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

或者对此进行侦听,以在包括外部[ Source ]在内的所有接口上进行监听: bottle.run,Bottle API参考]:

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)

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

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.

这篇关于如何从局域网上的另一台PC访问瓶子开发服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆