From 8ae90c58ac6f87aec711701b726fda7b261544cf Mon Sep 17 00:00:00 2001 From: Anton Samarchyan Date: Thu, 26 Jan 2017 18:45:07 -0500 Subject: [PATCH] Slightly simplified django.conf.urls.static.static(). --- django/conf/urls/static.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/conf/urls/static.py b/django/conf/urls/static.py index e8f8a9e804..8b5995953b 100644 --- a/django/conf/urls/static.py +++ b/django/conf/urls/static.py @@ -18,10 +18,10 @@ def static(prefix, view=serve, **kwargs): ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) """ # No-op if not in debug mode or an non-local prefix - if not settings.DEBUG or (prefix and '://' in prefix): - return [] - elif not prefix: + if not prefix: raise ImproperlyConfigured("Empty static prefix not permitted") + elif not settings.DEBUG or '://' in prefix: + return [] return [ url(r'^%s(?P.*)$' % re.escape(prefix.lstrip('/')), view, kwargs=kwargs), ]