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
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- Flask--AttributeError 'bool' object has no attribute '__call__'
- AttributeError: 'bool' object has no attribute '__call__'
- 使用ip代理池爬虫时,requests模块get请求出现问题_AttributeError: 'str' object has no attribute 'get'
- AttributeError: 'module' object has no attribute 'face' 问题解决 opencv+python
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- Flask 上的 AttributeError: 'bool' object has no attribute '__call__'问题
- ESRGAN复现时出现问题 AttributeError: 'NoneType' object has no attribute 'astype'
- 机器学习案例的小问题,AttributeError: 'Series' object has no attribute 'reshape'的解决
- AttributeError: 'NoneType' object has no attribute 'split'问题处理
- AttributeError: ‘module’ object has no attribute’xxx 问题解决
- 使用旧版本tensorflow出现了negative等报错的问题,AttributeError: 'module' object has no attribute 'xxx'"
- 解决问题 AttributeError: 'module' object has no attribute 'face_recognition_model_v1'
- AttributeError: ‘module’ object has no attribute’ 问题
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- AttributeError: 'module' object has no attribute 'post'问题
- 【Python错误】AttributeError: 'bool' object has no attribute '__call__'
- 使用vectorizer.fit_transform时出现AttributeError: 'file' object has no attribute 'lower'
- 纯小白问题……为啥pygal的Bar不好用?AttributeError: module 'pygal' has no attribute 'Bar'错误解决
- AttributeError: 'Tensor' object has no attribute '_keras_history'