diff gpp/urls.py @ 580:c525f3e0b5d0

Use the static() function to serve MEDIA files in development.
author Brian Neal <bgneal@gmail.com>
date Sat, 05 May 2012 15:08:07 -0500
parents 217a6319278c
children
line wrap: on
line diff
--- 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<path>.*)$', '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)