# HG changeset patch # User Brian Neal # Date 1336248487 18000 # Node ID c525f3e0b5d05c433471c6b0463cb82071109dfa # Parent 217a6319278cffb67e9b57bbd1f9db1396b02c52 Use the static() function to serve MEDIA files in development. diff -r 217a6319278c -r c525f3e0b5d0 gpp/urls.py --- a/gpp/urls.py Sat May 05 14:59:20 2012 -0500 +++ b/gpp/urls.py Sat May 05 15:08:07 2012 -0500 @@ -1,4 +1,5 @@ from django.conf.urls import patterns, url, include +from django.conf.urls.static import static from django.conf import settings from django.contrib import admin from django.views.decorators.cache import cache_page @@ -65,8 +66,5 @@ name='haystack_search'), ) - -if settings.DEBUG: - urlpatterns += patterns('', - (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), - ) +# For serving media files in development only: +urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)