Created
September 18, 2013 14:45
-
-
Save hcliff/6610224 to your computer and use it in GitHub Desktop.
Example dev media serving
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
# Create your urlpatterns here | |
if settings.DEBUG: | |
urlpatterns = patterns('django.views.static', | |
(r'^%s/(?P<path>.*)$' % settings.MEDIA_URL.strip('/'), 'serve', | |
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), | |
(r'^%s/(?P<path>.*)$' % settings.DEV_MEDIA_URL.strip('/'), 'serve', | |
{'document_root': settings.GENERATED_MEDIA_DIR, 'show_indexes': True}), | |
(r'^%s/(?P<path>.*)$' % settings.STATIC_URL.strip('/'), 'serve', | |
{'document_root': settings.STATIC_ROOT, 'show_indexes': True}), | |
) + urlpatterns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment