django.core.exception.ImproperlyConfigured: Specifying a namespace in include() 解决办法

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.解决办法

原代码

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('learning_logs.urls', namespace='learning_logs')),
]

修改如下:

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path(' ', include(('learning_logs.urls', "learning_logs"), namespace='learning_logs')),
]

你可能感兴趣的:(Django)