url反向链接错误

'Specifying a namespace in include() without providing an app_name ’
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.

报这个错误:
app_name = ‘booktest’ #需要在前面加上一句这个
urlpatterns = [
url(r’^index1$’,views.index,name=‘index’),]

urlpatterns = [
path(‘admin/’, admin.site.urls),
url(r’^’,include(‘booktest.urls’,namespace=‘booktest’)),
]

发布了35 篇原创文章 · 获赞 0 · 访问量 426

猜你喜欢

转载自blog.csdn.net/mengzh620/article/details/103072523