推荐学习书目
› 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 · 3323 views
    This topic created in 3831 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
        1
    z370028987  
       Apr 7, 2016
    给的信息太少了。
    strahe
        2
    strahe  
       Apr 7, 2016
    配置里有 SECRET_KEY 吗
    cloverstd
        3
    cloverstd  
       Apr 7, 2016
    <input name="csrf_token" type="hidden" value="{{ csrf_token() }}">
    myyou
        4
    myyou  
    OP
       Apr 7, 2016
    @strahe 有
    myyou
        5
    myyou  
    OP
       Apr 7, 2016
    @cloverstd 这个也加了
    1130335361
        6
    1130335361  
       Apr 7, 2016
    @myyou 换成 {{ form.hidden_tag() }} 试试
    myyou
        7
    myyou  
    OP
       Apr 8, 2016
    @1130335361 我用的就是{{ form.hidden_tag() }}
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2380 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 12:02 · PVG 20:02 · LAX 05:02 · JFK 08:02
    ♥ Do have faith in what you're doing.