1
我写了一点cherrypy“HelloWorld”示例,并且cp
开始没有问题。但是我只看到一个空白页时,我做的http://domain.com:8888Cherrypy可达,但没有显示任何东西
的请求。如果我改变请求的端口,我得到这个资源是不可达的浏览器的错误,所以我想cp
一般可达但没有显示任何东西
任何想法我做错了什么?
这里是CP来源:
import MySQLdb as mdb
import cherrypy as cp
class HelloWorld(object):
@cp.expose
def index(self):
return ("gurk")
@cp.expose
def default(self):
return "default"
def run_server():
# Set the configuration of the web server
cp.config.update({
'engine.autoreload.on': True,
'log.screen': True,
'server.socket_port': 8888,
'server.socket_host': '0.0.0.0'
})
# Start the CherryPy WSGI web server
cp.root = HelloWorld()
cp.engine.start()
cp.engine.block()
if __name__ == "__main__":
cp.log("main")
run_server()