Question

I am running my django based website in my local using apache mod_wsgi. Every-time I make a change to the python code, I need to restart my apache gracefully for the changes to take effect. Is there a way to configure apache in my local machine so that it takes up the new change without restart/graceful?

This is my current VirtualHost & Apache configuration:

<VirtualHost *:9001>
    DocumentRoot /public/gdp/trunk/
    ErrorLog /home/root/apache/error_log
    CustomLog /home/root/apache/access_log combined
    WSGIDaemonProcess root.com processes=5 threads=15
    WSGIProcessGroup root.com
    WSGIScriptAlias / /etc/httpd/conf/test.wsgi
    <Directory /etc/httpd/conf/>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
<IfModule prefork.c>
    StartServers       5
    MinSpareServers    1
    MaxSpareServers   5
    ServerLimit      5
    MaxClients       5
    MaxRequestsPerChild  1
</IfModule>
Was it helpful?

Solution

Easiest is to just use Django's development server: ./manage.py runserver

However, if you really have to run your code in Apache, then code reloading is described in here: http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

OTHER TIPS

Your test.wsgi can be a tiny script that handles automatically reloading other modules which you can then change on the fly. You'd have to restart apache to see changes to test.wsgi though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top