这是我的错误消息
Traceback (most recent call last): File "app.py", line 9, in
<module>
from forms import ContactForm File "/home/wdgzephy/zephy-Web/forms.py", line 1, in <module>
from flask.ext.wtf import Form, TextField, TextAreaField, SubmitField, validators, ValidationError File
"/home/wdgzephy/zephy-Web/venv/local/lib/python2.7/site-packages/flask/exthook.py",
line 87, in load_module
raise ImportError('No module named %s' % fullname) ImportError: No module named flask.ext.wtf.TextField
你能否帮我解决这个错误。我的错是什么?
答案 0 :(得分:1)
您必须导入wtforms(对于烧瓶版本0.9.0及更高版本):
from flask.ext.wtf import Form
from wtforms import TextField, TextAreaField, SubmitField
from wtforms.validators import Required
答案 1 :(得分:0)
您是否安装了Flask-WTF包? 你正在使用哪个版本的Flask?在当前版本中,正确的导入语法为:
>>> from wtforms import TextField
>>> wtforms.__version__
'2.0.2'