What is the advantage of using django.conf.urls.patterns compared to the url list in Django

Are there any advantages to using django.conf.urls.patterns compared to just a list of URLs?

For example, what is the difference between

 urlpatterns = [ url(r'^admin/', include(admin.site.urls)), ] 

vs

 urlpatterns = patterns( '', url(r'^admin/', include(admin.site.urls))) 
+8
python url django
source share
1 answer

You should use a list because templates () are deprecated from version 1.8 and will be removed in 1.10:

 def patterns(prefix, *args): warnings.warn( 'django.conf.urls.patterns() is deprecated and will be removed in ' 'Django 1.10. Update your urlpatterns to be a list of ' 'django.conf.urls.url() instances instead.', RemovedInDjango110Warning, stacklevel=2 ) 
+7
source share

All Articles