Python(CherryPy)Web应用程序本地部署,但在Intranet上不可见 [英] Python (CherryPy) web app deployed locally, but not visible over intranet

查看:50
本文介绍了Python(CherryPy)Web应用程序本地部署,但在Intranet上不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用CherryPy创建了一个Python网络应用,并已部署在我的本地计算机上.

I've created a Python web app using CherryPy, and have deployed in on my local machine.

当我尝试从房屋中的另一台计算机查看它时,什么也没回来.

When I try to view it from another computer in the house, nothing comes back.

但是,如果我创建一个简单的html文件,并通过以下方式进行部署:

However, if I create a simple html file, and deploy it with:

$ python -m SimpleHTTPServer

它在Intranet上可见.

It is visible over the intranet.

由于这些机器之间没有连接问题,而且我可以在同一端口上提供其他内容,因此我对为什么我的应用程序可以在本地运行但无法在Intranet上运行感到很困惑.

I'm stumped as to why my app could work locally, but not be avalable over the intranet, given that there is not a connection problem between these machines, and that I can serve other content on the same port.

我还没有使用配置文件,我正在使用默认的CherryPy设置.

I have not used a configuration file, I'm using the default CherryPy settings.

推荐答案

默认设置可能绑定到本地主机,而本地主机是不公开的.如果您希望CherryPy在公共界面上运行,则必须指示它执行此操作.在此讨论中,我发现:

The default settings likely bind to localhost, which is not publicly available. If you want CherryPy to run on a public interface, you'll have to direct it to do that. From this discussion I found:

cherrypy.config.update(
    {'server.socket_host': '10.149.4.240' } ) # Pub IP
cherrypy.quickstart()

cherrypy.config.update(
    {'server.socket_host': '0.0.0.0'} )      
cherrypy.quickstart()

绑定到所有接口.

这篇关于Python(CherryPy)Web应用程序本地部署,但在Intranet上不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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