我找到flask-jquery-ajax-example,我尝试使用最新的库版本运行它:
$ pip install flask flask-wtf wtforms
$ pip install -e ./
但是,在启动脚本时,我得到了 ImportError:没有名为flask.ext.wtf.SelectField 的模块:
$ python bin/runserver.py
Traceback (most recent call last):
File "bin/runserver.py", line 2, in <module>
from fjae import run_dev_server
File "/home/mic/tmp/flask-jquery-ajax-example/fjae/__init__.py", line 3, in <module>
from fjae import views
File "/home/mic/tmp/flask-jquery-ajax-example/fjae/views.py", line 6, in <module>
from fjae.forms import VehicleForm
File "/home/mic/tmp/flask-jquery-ajax-example/fjae/forms.py", line 1, in <module>
from flask.ext.wtf import Form, SelectField
File "/home/mic/.virtualenvs/unisnp/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.SelectField
SelectField是否被新方法取代?
答案 0 :(得分:2)
该教程在大约2年内没有更新。 Flask-WTF dropped support for field imports几个版本之前。您需要直接从WTForms导入它们。
from wtforms import SelectField