发现一个简单报错,简单记录一下。
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.
这个问题不要慌,很简单,去按照报错信息去查
这里发现主路由的include写法有问题
更改前:
# 指向index的路由文件urls.py
path('', include(('index.urls', 'index'), namespace='index'),
更改后:
# 指向index的路由文件urls.py
path('', include(('index.urls', 'index'), namespace='index')),
少了一层括号