CherryPy Hello World error

前端 未结 10 1046
广开言路
广开言路 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:24

    I ran into this problem yesterday on an Ubuntu Linux server. I spent a couple of hours trying to track down the bug in the CherryPy code before I realized that the error message is very generic. It will give this error message even if the host doesn't own the IP address to which the server is attempting to bind. In my case, the loopback interface (lo, 127.0.0.1) was disabled. Thus, even if I set server.socket_host='0.0.0.0', the attempt to check the port, wait_for_occupied_port, would fail (as it assumes, reasonably, that the loopback interface is always available). After re-enabling the loopback interface, the CherryPy server would start up normally.

    Update: CherryPy 3.2.3 has a fix for this particular issue. Until 3.2.3 is released, development builds are available on the CherryPy project downloads.

提交回复
热议问题