我有一个现有的Flask应用程序,并试图添加Flask-Blogging扩展到它。添加扩展引发ImportError: cannot import name FlaskForm
时,flask_blogging
尝试from flask_wtf import FlaskForm
。
Traceback (most recent call last):
File "run.py", line 11, in <module>
blog_engine = BloggingEngine(app, sql_storage)
File "/usr/local/lib/python2.7/dist-packages/flask_blogging/engine.py", line 66, in __init__
self.init_app(app, storage)
File "/usr/local/lib/python2.7/dist-packages/flask_blogging/engine.py", line 96, in init_app
from .views import create_blueprint
File "/usr/local/lib/python2.7/dist-packages/flask_blogging/views.py", line 11, in <module>
from flask_blogging.forms import BlogEditor
File "/usr/local/lib/python2.7/dist-packages/flask_blogging/forms.py", line 1, in <module>
from flask_wtf import FlaskForm
ImportError: cannot import name FlaskForm
字符串
我使用的是Flask 0.11.1和Flask-WTF 0.12。
3条答案
按热度按时间g6ll5ycj1#
您安装了旧版本的Flask-WTF,但Flask-Blogging需要更新版本。请升级Flask-WTF。
字符串
Flask-WTF在2016年9月29日发布的0.13版本中将
Form
重命名为Flask-Form
。gg0vcinb2#
试试这个:从wtforms.form导入表单
d6kp6zgx3#
旧版本:from flask_wtf import表单