报错:werkzeug.routing.BuildError: Could not build url for endpoint 'web.redraw_from_wish' with values

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_44555296/article/details/100330405

报错页面
报错意思是:无法使用值[‘isbn’]为端点’web.redraw_from_wish’构建url
排查后发现:
在这里插入图片描述
@web.route(’/my/wish’) #心愿清单
@login_required
def my_wish():
uid = current_user.id #获取用户id
wishes_of_mine = Wish.get_user_wishes(uid) #根据用户id获取用户所有心愿
isbn_list = [wish.isbn for wish in wishes_of_mine] #遍历用户所有心愿,获得心愿列表清单
gift_count_list = Wish.get_gifts_counts(isbn_list) #根据清单获得礼物数量
view_model = MyWishes(wishes_of_mine,gift_count_list)
return render_template(‘my_wish.html’,wishes=view_model.gifts)
所以出现了报错,修正后的代码应该是:
return render_template(‘my_wish.html’,wish=view_model.gifts)

猜你喜欢

转载自blog.csdn.net/weixin_44555296/article/details/100330405
今日推荐