重新启动在Apache + mod_python上运行的Django应用程序 [英] Restarting a Django application running on Apache + mod_python

查看:116
本文介绍了重新启动在Apache + mod_python上运行的Django应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Apache + mod_python上运行一个Django应用程序。当我对代码进行一些更改时,有时它们会立即生效,其他时候它们不会重新启动Apache。但是我并不想这样做,因为它也是一个运行其他东西的生产服务器。还有其他一些方法来强制吗?



只是为了清楚,因为我看到有些人错了,我在说一个 / em>环境。对于开发,我当然使用Django的开发服务器。

解决方案

如果可能的话,你应该切换到mod_wsgi。现在,这是推荐的方式为Django提供服务,而且很多在内存和服务器资源方面更有效率。



在mod_wsgi中,每个站点都有一个 .wsgi 文件关联它。要重新启动网站,只需触摸相关文件,只有该代码将被重新加载。


I'm running a Django app on Apache + mod_python. When I make some changes to the code, sometimes they have effect immediately, other times they don't, until I restart Apache. However I don't really want to do that since it's a production server running other stuff too. Is there some other way to force that?

Just to make it clear, since I see some people get it wrong, I'm talking about a production environment. For development I'm using Django's development server, of course.

解决方案

If possible, you should switch to mod_wsgi. This is now the recommended way to serve Django anyway, and is much more efficient in terms of memory and server resources.

In mod_wsgi, each site has a .wsgi file associated with it. To restart a site, just touch the relevant file, and only that code will be reloaded.

这篇关于重新启动在Apache + mod_python上运行的Django应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆