I’ve been working on a Django project, and just went to set it up on my web host (Dreamhost). It turns out that the instructions are a bit complicated, but manageable.

The sticking point, though, is that the local server (python manage.py runserver) allows you to serve static content, but this doesn’t work on a live application.

    (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'static/'})

I wanted to replicate this behaviour on the live app (so that I didn’t need to worry about running different code bases between development and production), but the default FastCGI configuration described in the wiki won’t do this (and instead suggests setting up a “media domain”).

Here’s my .htaccess that gets the static content served:

RewriteEngine On
 
Options +FollowSymlinks
 
RewriteBase /
RewriteRule ^(static/.*)$ - [L]
RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]

Then I symlinked the static directory from my SVN checkout into my wwwroot. And it all worked like magic!