Skip to content

Instantly share code, notes, and snippets.

@bradwright
Created March 20, 2009 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradwright/82335 to your computer and use it in GitHub Desktop.
Save bradwright/82335 to your computer and use it in GitHub Desktop.
# settings.py
# go up two levels
MEDIA_ROOT = os.path.join(os.path.dirname(__file__), '../../www/')
# in bottom of urls.py
# this is for serving static files in development
if settings.DEBUG:
import os
# get the static path from settings
static_url = settings.MEDIA_URL
if static_url.startswith('/'):
static_url = static_url.lstrip('/')
urlpatterns += patterns('',
(
r'^%s(?P<path>.*)$' % static_url,
'django.views.static.serve',
{
'document_root': settings.MEDIA_ROOT
}
),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment