python - 正确实现 Cherrypy 的 autoreload 模块的方法

标签 python cherrypy restart

作为标题,我正在学习 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/

相关文章:

java - 从最近的应用程序列表中选择应用程序 - 行为不一致

c - 如何通过关闭 C 中的所有文件描述符来重新启动或启动进程

python - 如何使用 curve_fit 和线性线函数使用散点图绘制下边界?

python - 从被比较的两个字典之一的键创建一个新字典,Python

CherryPy 服务器名称标签

python - CherryPy 将查询字符串值与 POST 正文中的表单值结合起来

python - CherryPy 身份验证超时

azure - 如何在 Azure Cli 中查询多个标签

Python - Pygame - Class __init___ 问题/不绘图

python - 如何将数据帧中的连接值插入 Pyspark 中的另一个数据帧?