Are there benefits for using django.conf.urls.patterns
versus just a list of url?
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)))
You should use a list because patterns() is deprecated since 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
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With