每当我关闭服务器,再次打开并尝试访问路由时 以前的令牌没有登录到应用程序,它给了我500内部服务器 错误而不是'身份验证失败'。有什么解决方案吗? 此
@app.route('/secret_page', methods=['GET'])
@jwt_required
def secret_page():
print "secret page"
return jsonify({'Success': True})
错误是
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
答案 0 :(得分:0)
只是一个猜测,但尝试在您的烧瓶应用配置中设置PROPAGATE_EXCEPTIONS = True
。或者看看使用flask_jwt_extended,它会为你处理这个问题,并且仍在积极维护。已经放弃了一段时间的Flask_jwt(完全披露,我是作者或flask_jet_extended)。