CherryPy Hello World error

前端 未结 10 1106
广开言路
广开言路 2020-12-31 07:32

When I am running CherryPy Hello World:

import cherrypy

class HelloWorld:
    def index(self):
        return \"Hello world!\"
    index.exposed = True

che         


        
10条回答
  •  醉酒成梦
    2020-12-31 08:09

    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
    

提交回复
热议问题