Monthly Archives: June 2009

Django deployed through CGI, on shared hosting

After a couple of hours of work, I finally got Django to work on my shared host.

First the link:, give it a try. (moved hosts and broke the script)

How it works

Django is a Python web framework, it’s MVC, it has a nice ORM abstraction layer, nice form handling and a lot of other goodies for us web developers.

I started playing with it a couple of days ago and I like what I’m seeing.

The only problem is that it needs a proper web host.

To solve this problem, I needed to load the whole framework from a CGI script.

The script I used is:

The code works, but it is a horrible hack and using it will slow any non trivial application to a grind under the slightest of loads.

The python interpreter, the Django framework and your application code is loaded on each request, only to be thrown out after the request’s life ends.

Sounds a little like PHP, the only difference is that mod_php doesn’t create a new process like the CGI protocol does. Don’t get me wrong this difference is significant.

Why did I waste two hours trying to get this thing to work if I can’t use it? Well, I’m a geek, and like any geek, I like these kind of things.

If you want proper Django support, try WebFaction, I’ve been using them for a few years and they’re great.