Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 452
Eric Wilson Avatar asked Sep 21 '11 03:09

Eric Wilson


1 Answers

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.

like image 149
Gringo Suave Avatar answered Nov 02 '22 11:11

Gringo Suave