Django 1.10 is deprecated

There is an obsolescence warning. Here is the problem:

RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got django.views.static.serve). Pass the callable instead. 'document_root': settings.MEDIA_ROOT, 

Here is the url:

 urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^ckeditor/', include('ckeditor_uploader.urls')), url(r'^media/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT, }), url(r'^post/(\d+)$', post), url(r'^(\w+)$', category), url(r'^$', category), ] 

How to fix it? Thank you for your time.

+6
source share
1 answer

Replace function paths in line with valid view functions. For instance:

 from django.views.static import serve ... url(r'^media/(?P<path>.*)$', serve, { 'document_root': settings.MEDIA_ROOT, }), 
+14
source

All Articles