J'ai un avertissement de dépréciation dans Django 1.11 :
RemovedInDjango20Warning: Passing a 3-tuple to django.conf.urls.include() is deprecated. Pass a 2-tuple containing the list of patterns and app_name, and provide the namespace argument to include() instead.
url(r'^admin/', include(admin.site.urls))
Dans Django 2.0, cela donne l'erreur suivante :
django.core.exceptions.ImproperlyConfigured: Passing a 3-tuple to include() is not supported.
Pass a 2-tuple containing the list of patterns and app_name, and provide the namespace argument to include() instead.
Comment dois-je changer url(r'^admin/', include(admin.site.urls))
? J'ai essayé de consulter la documentation, mais je n'ai aucune idée ...
Voici mon urls.py :
from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/django-ses/', include('django_ses.urls')),
url(r'^api/1.0/', include('feedcrunch_api_v1.urls')),
url(r'^oauth/', include('oauth.urls')),
url(r'^@(?P<feedname>\w+)/admin/', include('feedcrunch_rssadmin.urls')),
url(r'^@(?P<feedname>\w+)/', include('feedcrunch_rssviewer.urls')),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'', include('feedcrunch_home.urls')),
]
3 votes
D'ailleurs, vous pouvez supprimer
admin.autodiscover()
-- il n'a pas été demandé depuis Django 1.7 .