Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Provide the namespace argument to include() instead on django 3.0

In Django 3.0 this gives the error:

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.

How should I change url(r'^admin/', include(admin.site.urls))? I tried to look at the documentation,

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^hello/', include(myapp.views)),
]
like image 207
Mitesh Sathavara Avatar asked Jan 06 '20 12:01

Mitesh Sathavara


1 Answers

remove include from admin urls and use path

from django.urls import path, include
urlpatterns = [
   path('admin/', admin.site.urls),
   path('hello/', include('myapp.views')),
]

refer this django 3 doc.

like image 87
rahul.m Avatar answered Sep 30 '22 19:09

rahul.m