如果应用范围中的某些.py
或.ini
文件发生了变化,Pyramid会自动重启。
我需要观看更多文件(它们不是.py
或.ini
) - 如何将它们添加到金字塔监控中?
答案 0 :(得分:1)
在自定义watchdog实现中实现所需行为时,您(并且可能是某天金字塔本身)可能会更好。按照我的想法......
创建一个脚本,使您的PasteDeploy .ini
文件运行pserve
命令,并为要监视的文件扩展名安装监视程序。
Watchdog事件处理程序只会更改.ini
文件的修改时间,因为此文件已由金字塔观察程序监视。
$ 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,了解如何驾驶看门狗。