1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

Fixed #23276 -- Deprecated passing views as strings to url().

This commit is contained in:
Tim Graham
2014-08-12 10:54:42 -04:00
parent 2003cb23d4
commit a9fd740d22
28 changed files with 207 additions and 182 deletions

View File

@@ -1,5 +1,6 @@
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfiles.views import serve
urlpatterns = []
@@ -10,7 +11,7 @@ def staticfiles_urlpatterns(prefix=None):
"""
if prefix is None:
prefix = settings.STATIC_URL
return static(prefix, view='django.contrib.staticfiles.views.serve')
return static(prefix, view=serve)
# Only append if urlpatterns are empty
if settings.DEBUG and not urlpatterns:

View File

@@ -21,7 +21,9 @@ def serve(request, path, insecure=False, **kwargs):
To use, put a URL pattern such as::
(r'^(?P<path>.*)$', 'django.contrib.staticfiles.views.serve')
from django.contrib.staticfiles import views
url(r'^(?P<path>.*)$', views.serve)
in your URLconf.