Running mod_wsgi in Daemon Mode
If you are tired of having to reload Apache each time you make a change to the Python files in Django then read on. There is a way around this and it involves using mod_wsgi in daemon mode. This allows you to 'touch' the WSGI file and have Apache automatically pick up the changes. To set this up all you need to do is add the following lines to your /etc/apache2/sites-available/django.conf file within the VirtualHost directive (created in an earlier post):
WSGIDaemonProcess [domain-name] user=[linux-user] group=[linux-group] threads=25
WSGIProcessGroup [domain-name]
Replace [domain-name] with your domain name, and [linux-user] and [linux-group] with the user and group that you have setup for your Django website. Once you add the above lines, restart Apache. From then on, if you make a change to the Python files in your Django project, you just have to touch the WSGI file like so:
touch django.wsgi
This will get Apache to recognize the changes by updating the timestamp on the WSGI file. There are also a few other neat things that can be done when using mod_wsgi in daemon mode (such as specifying the Python path when working with virtualenv) but I will go over those options at a later date.