11
Apr

Django on Shared Hosting (with FCGI)

Posted on April 11, 2011 by justin

The django docs have a pretty good page on using fastcgi in a shared hosting environment, but there was always one part that bugged me:

touch mysite.fcgi

That has never worked. It's not turned on by default, and the (admittedly few, I prefer to use VPSes) shared hosts I've used, haven't bothered to enable it.

Enter the modwsgi docs! Specifically, this page, and more accurately, the code in the "Monitoring for code changes" section. Simply copy and paste the monitor code into a monitor.py, put it on your python path, and in your mysite.fcgi file, add the following code above runfastcgi(....):

import monitor
monitor.start(interval=1.0)
monitor.track(os.path.join(__file__))

That's it! Support in apache for reloading code is no longer required, and I can touch mysite.fcgi to reload my code!

Comments

0 comments have been posted.

Post a comment