小编Gao*_*ang的帖子

is_authenticated()引发TypeError TypeError:'bool'对象不可调用

我试图is_authenticated()在视图中使用,但得到错误`TypeError:'bool'对象不可调用.为什么我会收到此错误,如何解决?

@auth.before_app_request
def before_request():
    if current_user.is_authenticated() \
            and not current_user.confirmed \
            and request.endpoint[:5] != 'auth.' \
            and request.endpoint != 'static':
        return redirect(url_for('auth.unconfirmed'))
Run Code Online (Sandbox Code Playgroud)

python flask flask-login

13
推荐指数
2
解决办法
2万
查看次数

标签 统计

flask ×1

flask-login ×1

python ×1