如何导入Flask-WTF?

时间:2017-08-13 12:33:34

标签: python flask flask-wtforms

我最近使用pip安装了Flask-WTF和wtforms以及wtf。我只是不知道如何在我的python文件__init__.py中导入其中任何一个。我试过了:

from wtforms import Form
from Flask_WTF import Form
from wtf import Form
from flask_wtf import Form
from flask_wtforms import Form

等...

大多数Flask Documentations告诉我使用from wtforms import Form ......但它显示ImportError: No module named wtforms。看起来你必须导入WTF(或者它被称为)的方式不再相同了。有谁知道如何导入WTF?谢谢!

更新

我在python site-packages目录usr/lib/python2.7/site-packages中搜索了Flask-WTF,发现没有任何东西可以引用Flask-WTF。在运行pip install Flask-WTFpip install wtfpip install wtforms之后,甚至没有安装Flask-WTF,即使终端返回它也是如此。有谁知道为什么?

1 个答案:

答案 0 :(得分:0)

I noticed that pip doesn't install Flask-WTF, so I did it with easy_install, it worked, and I could import what I wanted to import.