LoginSignup
1
3

More than 5 years have passed since last update.

Python Flask-WTFを動かしてみた

Last updated at Posted at 2015-12-22

環境

Python3.4

Flask-WTFとは

FlaskとWTFormsをいい感じに統合してくれるプラグイン

動かしてみた.

Flaskでフォームを使う必要があったので,
https://flask-wtf.readthedocs.org/en/latest/quickstart.html
ここのとおりに動かしてみたところ,動かず.

view.py
# 公式のサンプル
@app.route('/submit', methods=('GET', 'POST'))
def submit():
    form = MyForm()
    if form.validate_on_submit():
        return redirect('/success')
    return render_template('submit.html', form=form)

https://flask-wtf.readthedocs.io/en/latest/quickstart.html

Python-WTFのほうのDocumentを見たところ

view.py
form = MyForm(csrf_enabled=False)

動きました.

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3