Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why do we need to restart apache after changing some file in django project

Tags:

apache

django

I have set up Django on Windows 7 on Apache/mod_wsgi. I need to stop, and then then start the server every time I change any python code. Is there a way to avoid it?

This doesn't happen with javascript/php changes, i.e., no apache restart required for seeing effect of changed code. A push in the right direction would help greatly. Thanks!

like image 231
Unos Avatar asked Feb 28 '12 10:02

Unos


2 Answers

You don't have to restart Apache. Just modify the wsgi file (in an UNIX environment, you could use touch myfile.wsgi) and it will be reloaded. In other words, just make sure the last modification date of your wsgi file is updated, even if the file contents itself is not.

P.S. I'm assuming you're running in daemon mode. If you're using embedded mode, then my suggestion won't help you, and I dunno if it's possible to do that at all... See also this question.

Edit: sorry, I didn't know daemon mode was only supported on UNIX. In that case, maybe the links in the other question will help, but I can't tell for sure, since I've got no experience with it.

like image 165
mgibsonbr Avatar answered Oct 05 '22 04:10

mgibsonbr


Read the official documentation about it at:

http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

like image 20
Graham Dumpleton Avatar answered Oct 05 '22 04:10

Graham Dumpleton