如何使用 Apache、mod_wsgi 在 Django 项目中重新加载新更新? [英] How to reload new update in Django project with Apache, mod_wsgi?
问题描述
我正在使用 Django 框架制作一个项目.我用 Apache+mod_wsgi 托管了一个测试服务器.当我更改某些代码行时,我会上传文件并在浏览器中对其进行测试.但是除非我重新加载/重新启动(/etc/init.d/apache2 reload
),否则不会显示新的更改.
I am making a project using the Django framework. I have hosted a test server with Apache+mod_wsgi. When I change some lines of code, I upload the file and test it in a browser. But the new changes are not shown unless I reload/restart (/etc/init.d/apache2 reload
).
除了重新加载 Apache 之外,还有其他方法可以重新加载/刷新新的更改吗?
Is there any other way to reload/refresh new changes besides reloading Apache?
推荐答案
是的,请修改您的 wsgi
配置文件.
Yes, touch your wsgi
configuration file.
对我来说,我的服务器重启脚本就像 touch/srv/grove_project/conf/apache/django.wsgi
一样简单.将它构建到您的服务器管理脚本中,这是一个很好的优雅重启.
For me, my server restart script is as simple as touch /srv/grove_project/conf/apache/django.wsgi
.
Build it into your server management scripts and it's a nice graceful restart.
有关更多信息以及何时适用:https://code.google.com/p/modwsgi/wiki/ReloadingSourceCode
For more info and when this applies: https://code.google.com/p/modwsgi/wiki/ReloadingSourceCode
来自 The Man 本人:这只适用于守护进程模式下的 mod_wsgi
.
From The Man himself: this only works with mod_wsgi
in daemon mode.
这篇关于如何使用 Apache、mod_wsgi 在 Django 项目中重新加载新更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!