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:
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user