Thoughts and tutorials on programming

Wednesday, June 06, 2007

Django static files, using fcgi

On blue host we use fcgi. So here is how to make static subdirectories work.
Django wants to host static files, for example the admin interface uses static files (hosted at /media/) for its css.
To create these what you will want to do is create create some sym links within your public_html/whatever sub-directory, then instruct apache, in .htaccess, to follow those links.

Here's an example for my admin media setup.


cd public_html/subdomain

ln -s media /home/wilkboar/checked_out_svn_all/edited_django_repository_files/django/contrib/admin/media

(media being where ADMIN_MEDIA_PREFIX is set to in settings.py -- defaults to media)

Then edit .htaccess, add
Options +FollowSymLinks
RewriteRule ^(media/.*)$ - [L]

media is the same name as the directory, above.

Repeat for other static files desired. Should work!

No comments:

Contributors

Followers