in urls.py:
if settings.DEBUG:
urlpatterns += patterns('',
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/home/me/web/site/site_media'}),
)
This only works with the local test server, see
http://www.djangoproject.com/documentation/modpython/#serving-media-files for
doing it in production with mod_python
in settings.py:
MEDIA_ROOT = '/home/me/web/site/site_media/'
MEDIA_URL = 'http://localhost:8000/site_media/'
/home/me/web/site is my root package for django (so settings.py is in
site/settings.py)
I have css files etc inside site_media and I refer to them in my html using
a /site_media prefix, so
<link rel="stylesheet" href="/site_media/css/site.css" type="text/css">
Hope that helps,
Tim.