When I am running CherryPy Hello World:
import cherrypy
class HelloWorld:
def index(self):
return "Hello world!"
index.exposed = True
cherrypy.config.update({'server.socket_port': 8080,})
cherrypy.quickstart(HelloWorld())
... I get this: IOError: Port 8080 not bound on 'localhost'. What could it be?
If you are trying to deploy CherryPy on Heroku, where you cannot use the loopback to check whether you have really opened a port, then you need to simply disable CherryPy's wait_for_occupied_port()
function so that CherryPy's self-consistency check does not decide that it has, in fact, failed to start. Here are the three lines that I use to fix CherryPy so that it runs on Heroku:
from cherrypy.process import servers
def fake_wait_for_occupied_port(host, port): return
servers.wait_for_occupied_port = fake_wait_for_occupied_port