Flask を使用して Web サイトを構築しています。現在、Flask_Securityをトークン ベースの認証に使用しようとしています。get_auth_token() メソッドを使用して、ユーザーから auth_token を取得したいと考えています。残念ながら、このメッセージの下にスタック トレースが表示されます。
誰が何が悪いのか知っていますか?すべてのヒントは大歓迎です!
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/kramer65/myapp-kram/app/views/apiviews.py", line 33, in api_login
return jsonify({'token': user.get_auth_token()})
File "/usr/local/lib/python2.7/dist-packages/flask_security/core.py", line 313, in get_auth_token
return _security.remember_token_serializer.dumps(data)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/local.py", line 338, in __getattr__
return getattr(self._get_current_object(), name)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/local.py", line 297, in _get_current_object
return self.__local()
File "/usr/local/lib/python2.7/dist-packages/flask_security/core.py", line 30, in <lambda>
_security = LocalProxy(lambda: current_app.extensions['security'])
KeyError: 'security'