I'm following @Miguel flask mega tutorial which is great. In chapter 3 he talks about web forms and flaskWTF extension, installing the extension like this sudo pip install Flask-WTF
resulted in
Successfully installed Flask-WTF Flask WTForms Werkzeug Jinja2 itsdangerous markupsafe
but when executing ./run.py
i get an error:
No module named flask.ext.wtf`
I've google the error and tried to run it like this: flask/bin/python run.py
but got the same error, also tried flask/bin/activate
Update: if you run into the same error this is what solved the issue for me I've installed the following, for sure they are not all needed but since i didn't go one by one to find out which one did the trick i'm listing them all
flask/bin/pip install flask-login
flask/bin/pip install flask-openid
flask/bin/pip install flask-mail
flask/bin/pip install sqlalchemy
flask/bin/pip install flask-sqlalchemy
flask/bin/pip install sqlalchemy-migrate
flask/bin/pip install flask-whooshalchemy==0.55a
flask/bin/pip install flask-wtf
flask/bin/pip install pytz
flask/bin/pip install flask-babel
flask/bin/pip install flup
The API has changed from:
from flask.ext.wtf import Form
to:
from flask_wtf import Form
See the docs here
You are probably using the import style from the older versions:
from flask.ext.wtf import Form, TextField, BooleanField
from flask.ext.wtf import Required
The import style changed starting from 0.9.0 version. Be sure to update your imports:
from flask.ext.wtf import Form
from wtforms.fields import TextField, BooleanField
from wtforms.validators import Required
You can find the note about this change in the upgrade section of docs:
https://flask-wtf.readthedocs.org/en/latest/upgrade.html#version-0-9-0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With