您的位置:首页 > 移动开发 > Objective-C

Flask 上的 AttributeError: 'bool' object has no attribute '__call__'问题

2020-01-14 19:02 1481 查看

这基本上是flask-login版本问题

1.下面这段文字没准能帮到你Posting this here so people can see it, this comes from a change in how UserMixin works in flask-login. I'd tell you to install a specific version of flask-login but...they removed those releases from PyPI.

So...instead of {{ current_user.is_authenticated() }}, you need to use {{ current_user.is_authenticated }}. Just don't include the parentheses. Yeah, it's an annoying change but, honestly, I think it's probably better code design.

 

2.lask-login的版本问题,flask-login2.x是current_user.is_authenticated(),flask-login3.x是current_user.is_authenticated。避免这个问题最好的办法就是使用虚拟环境并在requirement中写明版本号。

 

current_user.is_authenticated()基本出现在视图函数(views.py)和模板(templates)里面。

转载于:https://www.cnblogs.com/Hondsome/p/5985013.html

  • 点赞
  • 收藏
  • 分享
  • 文章举报
baizong2726 发布了0 篇原创文章 · 获赞 0 · 访问量 68 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐