How can I import Flask-WTF?

眉间皱痕 提交于 2019-12-12 05:49:35

问题


I recently installed Flask-WTF and wtforms and wtf, using pip. I just don't know how to import anyone of these in my python file __init__.py. I tried:

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

etc...

Most of the Flask Documentations tell me to use from wtforms import Form... But it shows ImportError: No module named wtforms. It seems like the way you have to import WTF (or however it is called) is not the same anymore. Does anyone know how to import WTF? Thank you!

Update:

I searched for Flask-WTF in the python site-packagesdirectory, usr/lib/python2.7/site-packages and found out that there is nothing refering to Flask-WTF. It appears that Flask-WTF was not even installed after running pip install Flask-WTF or pip install wtf or pip install wtforms, even tho the terminal returned that it was. Does anyone know why?


回答1:


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.



来源:https://stackoverflow.com/questions/45660399/how-can-i-import-flask-wtf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!