开发者

Python (CherryPy) web app deployed locally, but not visible over intranet

开发者 https://www.devze.com 2023-04-06 20:12 出处:网络
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.

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.

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

$ python -m SimpleHTTPServer

It is visible over the 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.

I have not used a configuration file, I'm using the default CherryPy settings开发者_如何转开发.


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()

or

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

To bind to all interfaces.

0

精彩评论

暂无评论...
验证码 换一张
取 消