实现Django从app01页面跳转到另一个app的页面:
app01中views.py:
if user:
return HttpResponseRedirect(reverse('app:index'))
app中urls.py:
app_name = 'app'
urlpatterns = [
url('index/', views.draw_graph),
]
但他就是报错Reverse for ‘index’ not found. ‘index’ is not a valid view function or pattern name.

解决方法:
app_name = 'app'
urlpatterns = [
url('index/', views.draw_graph, name='index'),
]
推荐一篇文章比较详细介绍了Django跳转到不同页面的方法和实例
本文探讨了在Django项目中遇到'Reverse for 'index' not found. 'index' is not a valid view function or pattern name.'错误的情况。内容包括如何从app01的视图跳转到其他应用的页面,以及解决该错误的详细方法和实例。


被折叠的 条评论
为什么被折叠?



