/django/contrib/staticfiles/urls.py

https://code.google.com/p/mango-py/ · Python · 16 lines · 9 code · 3 blank · 4 comment · 3 complexity · 4ffba2bbf45c8ea5e312a73c59bdf95e MD5 · raw file

  1. from django.conf import settings
  2. from django.conf.urls.static import static
  3. urlpatterns = []
  4. def staticfiles_urlpatterns(prefix=None):
  5. """
  6. Helper function to return a URL pattern for serving static files.
  7. """
  8. if prefix is None:
  9. prefix = settings.STATIC_URL
  10. return static(prefix, view='django.contrib.staticfiles.views.serve')
  11. # Only append if urlpatterns are empty
  12. if settings.DEBUG and not urlpatterns:
  13. urlpatterns += staticfiles_urlpatterns()