comparison 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
comparison
equal deleted inserted replaced
579:217a6319278c 580:c525f3e0b5d0
1 from django.conf.urls import patterns, url, include 1 from django.conf.urls import patterns, url, include
2 from django.conf.urls.static import static
2 from django.conf import settings 3 from django.conf import settings
3 from django.contrib import admin 4 from django.contrib import admin
4 from django.views.decorators.cache import cache_page 5 from django.views.decorators.cache import cache_page
5 6
6 from haystack.views import search_view_factory 7 from haystack.views import search_view_factory
63 url(r'^search/$', 64 url(r'^search/$',
64 search_view_factory(form_class=CustomModelSearchForm, load_all=True), 65 search_view_factory(form_class=CustomModelSearchForm, load_all=True),
65 name='haystack_search'), 66 name='haystack_search'),
66 ) 67 )
67 68
68 69 # For serving media files in development only:
69 if settings.DEBUG: 70 urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
70 urlpatterns += patterns('',
71 (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
72 )