我在项目根qazxsw poi中有以下url模式:
urls.py
但django抱怨以下消息:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('main/', include('main.urls', namespace='main')),
]
根据Django的django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.
,'main'的模式应该是正确的。有什么问题?
您需要将documentation添加到main.urls文件中。请参阅示例和说明app_name = 'main'
。