有没有一种“简单”的方法?如何让 mod_wsgi 反映 Django 更新?
我正在阅读 http://code.google.com/p/modwsgi/wiki/ ReloadingSourceCode 但这似乎工作量太大了,每当我对 Django 代码进行调整时,我都会优雅地重新启动我的 apache2 服务器,因为它不一致地获取正确的文件,并且可能尝试依赖缓存的 .pycs。
I'm reading http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode but it seems like way too much work, I've been restarting my apache2 server gracefully whenever I make tweaks to Django code as it inconsistently picks up the right files and probably tries to rely on cached .pycs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我按照 中概述的步骤使用 mod_wsgi 设置 Django这篇博文。
它会自动反映更新(尽管时不时地,会有几分钟的延迟 - 永远不会弄清楚为什么,也不会造成太大的不便)。
I setup Django using mod_wsgi using the steps outlined at this blog post.
It automatically reflects updates (although every now and then, there will be a delay for a few minutes - never figure out why nor is it that much of an inconvenience).
如果您必须重新启动 Apache 服务器,则无法使用 mod_wsgi 守护程序模式。使用守护进程模式,然后在完成一组原子更改后简单地触摸 WSGI 脚本文件并不那么困难,而且肯定比在检测到任何单个更改时任意重新启动的系统更安全。如果您确实希望根据代码更改自动重新启动,那么该文档中也对此进行了描述。对于 Django 的倾向,请阅读:
http ://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django.html
http://blog.dscpl。 com.au/2009/02/source-code-reloading-with-modwsgi-on.html
那里记录的“工作量太大”是什么?
If you are having to restart your Apache server then you can't be using mod_wsgi daemon mode. Use daemon mode and then simply touching the WSGI script file when an atomic set of changes have been completed isn't that hard and certainly safer than a system which restarts arbitrarily when it detects any single change. If you do want automatic restart based on code changes, then that is described in that document as well. For a Django slant on it, read:
http://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django.html
http://blog.dscpl.com.au/2009/02/source-code-reloading-with-modwsgi-on.html
What is it about what is documented there which is 'way too much work'?