To simplify URL configs, patterns()
was deprecated in Django 1.8, and removed in 1.10 (release notes). In Django 1.10, urlpatterns
must be a list of url()
instances. Using a tuple in patterns()
is not supported any more, and the Django checks framework will raise an error.
Fixing this is easy, just convert any tuples
urlpatterns = [
(r'^$', home, name='home'), # tuple
]
to url()
instances:
urlpatterns = [
url(r'^$', home, name='home'), # url instance
]
If you get the following NameError
,
NameError: name 'url' is not defined
then add the following import to your urls.py
:
from django.conf.urls import url
If you use strings in your url patterns, e.g. 'myapp.views.home'
, you'll have to update these to use a callable at the same time. See this answer for more info.
See the Django URL dispatcher docs for more information about urlpatterns
.