简体   繁体   English

在使用mod_wsgi的Apache上使用Django时必须重新启动Apache

[英]Have to Restart Apache When Using Django On Apache with mod_wsgi

I'm creating a web app with Django. 我正在用Django创建一个Web应用程序。 Since I'm very familiar with Apache I setup my development environment to have Django run through Apache using mod_wsgi. 由于我非常熟悉Apache,因此我设置了我的开发环境,让Django使用mod_wsgi运行Apache。 The only annoyance I have with this is that I have to restart Apache everytime I change my code. 我唯一的烦恼就是每次更改代码时都必须重新启动Apache。 Is there a way around this? 有没有解决的办法?

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. 反正你应该阅读有关自动的源代码重新加载。

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. 我制作了一个bash脚本,使其尽可能简单。 I name it 'ra' (reload apache) so it's short and quick. 我将它命名为'ra'(重载apache),因此它简短而快速。 The following works for most apache installs (on UNIX-based systems): 以下适用于大多数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. 您可以使用某种工具将其绑定到键快捷键/脚pedeal / cron。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM