django.core.exception.ImproperlyConfigured: Specifying a namespace in include () 해결 방법

3248 단어 Django
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')),
]

좋은 웹페이지 즐겨찾기