当在Apache上使用Django和mod_wsgi时,必须重新启动Apache吗

时间:2021-12-23 23:05:44

I'm creating a web app with Django. Since I'm very familiar with Apache I setup my development environment to have Django run through Apache using mod_wsgi. The only annoyance I have with this is that I have to restart Apache everytime I change my code. Is there a way around this?

我正在用Django创建一个web应用程序。由于我非常熟悉Apache,所以我将开发环境设置为使用mod_wsgi在Apache中运行Django。我唯一的烦恼是,每次修改代码时都必须重新启动Apache。有办法解决这个问题吗?

2 个解决方案

#1


15  

mod_wsgi is great for production but I think the included server is better for development.

mod_wsgi非常适合生产,但我认为包含的服务器更适合开发。

Anyway you should read this about automatic reloading of source code.

无论如何,您应该阅读这篇关于源代码自动重载的文章。

#2


-4  

I feel like this is really just one of those things most people deal with. It's really not that big of a deal. I made a bash script to make this as easy as possible. I name it 'ra' (reload apache) so it's short and quick. The following works for most apache installs (on UNIX-based systems):

我觉得这只是大多数人要面对的问题之一。没什么大不了的。我做了一个bash脚本,使其尽可能简单。我把它命名为“ra”(重载apache),所以它又短又快。对于大多数apache安装(基于unix的系统),可以使用以下方法:

#!/bin/bash
sudo /etc/init.d/apache2 reload

You could probably use some kind of tool to bind this to a key shortcut/foot pedeal/cron.

您可能会使用某种工具将其绑定到一个关键的快捷方式/英尺事务/cron。

#1


15  

mod_wsgi is great for production but I think the included server is better for development.

mod_wsgi非常适合生产,但我认为包含的服务器更适合开发。

Anyway you should read this about automatic reloading of source code.

无论如何,您应该阅读这篇关于源代码自动重载的文章。

#2


-4  

I feel like this is really just one of those things most people deal with. It's really not that big of a deal. I made a bash script to make this as easy as possible. I name it 'ra' (reload apache) so it's short and quick. The following works for most apache installs (on UNIX-based systems):

我觉得这只是大多数人要面对的问题之一。没什么大不了的。我做了一个bash脚本,使其尽可能简单。我把它命名为“ra”(重载apache),所以它又短又快。对于大多数apache安装(基于unix的系统),可以使用以下方法:

#!/bin/bash
sudo /etc/init.d/apache2 reload

You could probably use some kind of tool to bind this to a key shortcut/foot pedeal/cron.

您可能会使用某种工具将其绑定到一个关键的快捷方式/英尺事务/cron。