报错原因是小细节的问题。
解决方案:将所有的urls.py(包括项目中的url、app中的url)文件中 { } 改为 [ ]。
示例:urlpatterns = {} 改为 urlpatterns = []
urlpatterns = [
path(‘admin/’, admin.site.urls),
url(r’^App1/’, include(‘App1.urls’, namespace=‘app1’)),
url(r’^App2/’, include(‘App2.urls’, namespace=‘app2’)),
# path(‘App1/’, include(‘App1.urls’, namespace=‘app1’)),
# path(‘App2/’, include(‘App1.urls’, namespace=‘app2’)),
]
DJango中反向解析时报错TypeError at /App2/zy2index/ 'set' object is not reversible
最新推荐文章于 2022-04-21 14:04:53 发布