Created
June 11, 2013 06:10
-
-
Save tricoder42/5754777 to your computer and use it in GitHub Desktop.
Snippet to server static and media files in development.
This file contains 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
# Append to your urls.py file. | |
# Development | |
from django.conf import settings | |
if settings.DEBUG: | |
from django.conf.urls.static import static | |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
media = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | |
urlpatterns = media + staticfiles_urlpatterns() + urlpatterns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment