Skip to content

Commit

Permalink
Copy wicked development static hack from django-static-management
Browse files Browse the repository at this point in the history
  • Loading branch information
bradwright committed Dec 19, 2008
1 parent 24409d1 commit 5b86590
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions yoursite/urls.py
Expand Up @@ -20,12 +20,17 @@

# 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'^static/(?P<path>.*)$',
r'^%s(?P<path>.*)$' % static_url,
'django.views.static.serve',
{
'document_root': os.path.join(os.path.dirname(__file__), '../static')
'document_root': settings.MEDIA_ROOT
}
),
)

0 comments on commit 5b86590

Please sign in to comment.