How to install WTForms? Gettiing import error when trying to import forms
Question: I'm trying to follow the [Flask Mega
Tutorial](http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-
hello-world) for which I need to use WTForms. As is suggested in the tutorial,
I use a virtualenv in which I installed WTForms like this:

    
    
    flask/bin/pip install flask-wtf
    

This seemed to work fine, and when I now run it again I simply get this:

    
    
    Requirement already satisfied (use --upgrade to upgrade): flask-wtf in ./flask/lib/python2.7/site-packages
    Requirement already satisfied (use --upgrade to upgrade): Flask in ./flask/lib/python2.7/site-packages (from flask-wtf)
    Requirement already satisfied (use --upgrade to upgrade): WTForms>=1.0 in ./flask/lib/python2.7/site-packages (from flask-wtf)
    Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in ./flask/lib/python2.7/site-packages (from Flask->flask-wtf)
    Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in ./flask/lib/python2.7/site-packages (from Flask->flask-wtf)
    Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in ./flask/lib/python2.7/site-packages (from Flask->flask-wtf)
    Requirement already satisfied (use --upgrade to upgrade): markupsafe in ./flask/lib/python2.7/site-packages (from Jinja2>=2.4->Flask->flask-wtf)
    Cleaning up...
    

But when I try to import forms using `from forms import LoginForm` I get an
error saying: `ImportError: cannot import name LoginForm`.

Does anybody know what I'm doing wrong here, and how I can solve this? All
tips are welcome!


Answer: You need a module named `forms` that contains `LoginForm`,

    
    
    from flask.ext.wtf import Form
    from wtforms import TextField, BooleanField
    from wtforms.validators import Required
    
    class LoginForm(Form):
        openid = TextField('openid', validators = [Required()])
        remember_me = BooleanField('remember_me', default = False)
    

This is the example taken from [Part
iii](http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iii-web-
forms).

