mirror of
https://github.com/django/django.git
synced 2025-09-27 12:39:17 +00:00
Slightly simplified django.conf.urls.static.static().
This commit is contained in:
parent
c37ec5a659
commit
8ae90c58ac
1 changed files with 3 additions and 3 deletions
|
@ -18,10 +18,10 @@ def static(prefix, view=serve, **kwargs):
|
||||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
"""
|
"""
|
||||||
# No-op if not in debug mode or an non-local prefix
|
# No-op if not in debug mode or an non-local prefix
|
||||||
if not settings.DEBUG or (prefix and '://' in prefix):
|
if not prefix:
|
||||||
return []
|
|
||||||
elif not prefix:
|
|
||||||
raise ImproperlyConfigured("Empty static prefix not permitted")
|
raise ImproperlyConfigured("Empty static prefix not permitted")
|
||||||
|
elif not settings.DEBUG or '://' in prefix:
|
||||||
|
return []
|
||||||
return [
|
return [
|
||||||
url(r'^%s(?P<path>.*)$' % re.escape(prefix.lstrip('/')), view, kwargs=kwargs),
|
url(r'^%s(?P<path>.*)$' % re.escape(prefix.lstrip('/')), view, kwargs=kwargs),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue