推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
myyou
V2EX  ›  Python

flask 表单验证报错求助!

  •  
  •   myyou · Apr 7, 2016 · 3392 views
    This topic created in 3867 days ago, the information mentioned may be changed or developed.

    flask 使用 form.validate_on_submit()去验证老是通过不了,报错总是{'csrf_token': ['CSRF token missing']} 打印了一下 form.csrf_token.data 发现是有值的,不知道什么原因?

    7 replies  •  2016-04-08 09:57:00 +08:00
    z370028987
    z370028987
    Apr 7, 2016
    1
    给的信息太少了。
    strahe
    strahe
    Apr 7, 2016
    2
    配置里有 SECRET_KEY 吗
    cloverstd
    cloverstd
    Apr 7, 2016
    3
    <input name="csrf_token" type="hidden" value="{{ csrf_token() }}">
    myyou
    myyou
    OP
    Apr 7, 2016
    4
    @strahe 有
    myyou
    myyou
    OP
    Apr 7, 2016
    5
    @cloverstd 这个也加了
    1130335361
    1130335361
    Apr 7, 2016
    6
    @myyou 换成 {{ form.hidden_tag() }} 试试
    myyou
    myyou
    OP
    Apr 8, 2016
    7
    @1130335361 我用的就是{{ form.hidden_tag() }}
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1460 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 10:48 · PVG 18:48 · LAX 02:48 · JFK 05:48
    ♥ Do have faith in what you're doing.