作为标题,我正在学习 http://docs.cherrypy.org/en/latest/tutorials.html#tutorial-1-a-basic-web-application 的 cherrypy 教程。我想立即查看我的脚本中的更改,而无需重新启动我的 cherrypy 服务器。
我读自http://www.packtpub.com/article/overview-cherrypy-a-web-application-server-2有一个 autoreload
模块可以跳过重启过程,但我不知道如何实现它。
有人能帮忙吗?
最佳答案
我在 http://cherrypy.readthedocs.org/en/latest/deploy.html 中找到了它
import cherrypy
class Root(object):
@cherrypy.expose
def index(self):
return "Hello World!"
cherrypy.config.update({'server.socket_port': 8090,
'engine.autoreload_on': False,
'log.access_file': './access.log',
'log.error_file': './error.log'})
cherrypy.quickstart(Root())
它可以工作,但不能从 ipython notebook 运行 cherrypy 服务器脚本。
关于python - 正确实现 Cherrypy 的 autoreload 模块的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25114285/