文章内容

2018/9/26 15:06:54,作 者: 黄兵

has been renamed to "CSRFProtect" and will be removed in 1.0.

最近由于项目需要,页面上有多个提交表单,多可csrf会报错,所以修改了使用方式,具体参考这里:flask 多个form.csrf_token如何处理

但是在使用Flask_WTF.csrf的时候如下提示:

FlaskWTFDeprecationWarning: "flask_wtf.CsrfProtect" has been renamed to "CSRFProtect" and will be removed in 1.0.

  csrf = CsrfProtect()

flask_wtf.CsrfProtect将会在1.0版本中淘汰,所以不建议这么写。


解决方案:

原来写法:

from flask_wtf.csrf import CsrfProtect
csrf = CsrfProtect()

修改之后:

from flask_wtf.csrf import CSRFProtect
csrf = CSRFProtect()

这个警告消失,问题解决。

有什么问题下面交流。


其它相关推荐:

1、flask 多个form.csrf_token如何处理

2、Could not build url for endpoint 'xxx'. Did you forget to specify values ['xxx']?

3、Google reCAPTCHA 性能优化

4、The CSRF token is missing.

5、Flask文件上传


黄兵个人博客原创。

转载请注明出处:黄兵个人博客 - has been renamed to "CSRFProtect" and will be removed in 1.0.

分享到:

发表评论

评论列表