Skip to content

Instantly share code, notes, and snippets.

@tricoder42
Created June 11, 2013 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tricoder42/5754777 to your computer and use it in GitHub Desktop.
Save tricoder42/5754777 to your computer and use it in GitHub Desktop.
Snippet to server static and media files in development.
# 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