我尝试运行一些flask的扩展程序,以提供用户管理和身份验证/登录,例如flask-admin。问题是,每当我尝试运行将运行简单用户登录/注册页面的示例之一,然后单击登录或注册按钮时,我总是会收到以下错误:
TypeError:set_cookie()收到了意外的关键字参数“ samesite”
Python报告的完整错误日志为:
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2309, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1816, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1833, in finalize_request
response = self.process_response(response)
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2114, in process_response
self.session_interface.save_session(self, ctx.session, response)
File "/usr/lib64/python2.7/site-packages/flask/sessions.py", line 384, in save_session
samesite=samesite
我环顾四周,但找不到任何解决方案。我使用的不同组件的版本之间是否存在不匹配?我们非常感谢您的帮助。
答案 0 :(得分:1)
我升级到:
Flask>=1.0.2
Flask-Login==0.4.1
Werkzeug==0.14.1
错误消失了。我怀疑这是年龄较大的Werkzeug的问题