Pyramid 为自动重启监控的附加文件/目录
Additional files / directories to be monitored by Pyramid for autorestart
Pyramid 有一个很棒的功能,如果应用范围内的某些 .py
或 .ini
文件发生更改,它会自动重启。
我还有一些文件(它们既不是 .py
也不是 .ini
)需要监视 — 如何将它们添加到 Pyramid 监控?
您(也许有一天金字塔本身)可能会更好地将所需的行为实施到自定义 watchdog 实施中。跟随我的想法...
创建一个脚本,将您的 PasteDeploy .ini
文件发送给 运行 pserve
命令,并为要监控的文件扩展名安装看门狗。
Watchdog 事件处理程序仅更改 .ini
文件的修改时间,因为该文件已被 pyramid watcher 监控。
$ touch pyramid.ini
导致重新加载:
pyramid.ini changed; reloading...
-------------------- Restarting --------------------
2015-04-29 08:51:05,216 INFO [ZEO.ClientStorage] ('localhost', 8100) ClientStorage (pid=5263) created RW/normal for storage: '1'
2015-04-29 08:51:05,217 INFO [ZEO.cache] created temporary cache file '<fdopen>'
2015-04-29 08:51:05,227 INFO [ZEO.ClientStorage] ('localhost', 8100) Testing connection <ManagedClientConnection ('127.0.0.1', 8100)>
2015-04-29 08:51:05,228 INFO [ZEO.zrpc.Connection('C')] (127.0.0.1:8100) received handshake 'Z3101'
2015-04-29 08:51:05,329 INFO [ZEO.ClientStorage] ('localhost', 8100) Server authentication protocol None
2015-04-29 08:51:05,331 INFO [ZEO.ClientStorage] ('localhost', 8100) Connected to storage: ('localhost', 8100)
2015-04-29 08:51:05,332 INFO [ZEO.ClientStorage] ('localhost', 8100) No verification necessary -- empty cache
Starting server in PID 5263.
serving on http://0.0.0.0:6543
您甚至可以从 pserve
模块中导入适合您用例的有用内容。查看此 scripting approach 了解如何驱动看门狗。
Pyramid 有一个很棒的功能,如果应用范围内的某些 .py
或 .ini
文件发生更改,它会自动重启。
我还有一些文件(它们既不是 .py
也不是 .ini
)需要监视 — 如何将它们添加到 Pyramid 监控?
您(也许有一天金字塔本身)可能会更好地将所需的行为实施到自定义 watchdog 实施中。跟随我的想法...
创建一个脚本,将您的 PasteDeploy .ini
文件发送给 运行 pserve
命令,并为要监控的文件扩展名安装看门狗。
Watchdog 事件处理程序仅更改 .ini
文件的修改时间,因为该文件已被 pyramid watcher 监控。
$ touch pyramid.ini
导致重新加载:
pyramid.ini changed; reloading...
-------------------- Restarting --------------------
2015-04-29 08:51:05,216 INFO [ZEO.ClientStorage] ('localhost', 8100) ClientStorage (pid=5263) created RW/normal for storage: '1'
2015-04-29 08:51:05,217 INFO [ZEO.cache] created temporary cache file '<fdopen>'
2015-04-29 08:51:05,227 INFO [ZEO.ClientStorage] ('localhost', 8100) Testing connection <ManagedClientConnection ('127.0.0.1', 8100)>
2015-04-29 08:51:05,228 INFO [ZEO.zrpc.Connection('C')] (127.0.0.1:8100) received handshake 'Z3101'
2015-04-29 08:51:05,329 INFO [ZEO.ClientStorage] ('localhost', 8100) Server authentication protocol None
2015-04-29 08:51:05,331 INFO [ZEO.ClientStorage] ('localhost', 8100) Connected to storage: ('localhost', 8100)
2015-04-29 08:51:05,332 INFO [ZEO.ClientStorage] ('localhost', 8100) No verification necessary -- empty cache
Starting server in PID 5263.
serving on http://0.0.0.0:6543
您甚至可以从 pserve
模块中导入适合您用例的有用内容。查看此 scripting approach 了解如何驱动看门狗。