import settings if settings DEBUG urlpatterns patterns url media path

1
2
3
4
5
import settings
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)