view raw
Lorbat Lorbat - 6 months ago 58
Python Question

ImportError when importing Flask WTF forms

I can't see where I'm going wrong. I have the latest WTF forms installed but I still get this error.


from import Form
from wtforms import PasswordField, validators, fields
from wtforms.fields import TextField, BooleanField
from wtforms.validators import Required, Email, EqualTo


Traceback (most recent call last):

File "/bin/", line 67, in __call__
self.error_log_file.logger.exception("Error running WSGI application")
File "/usr/lib/python3.3/logging/", line 1269, in exception
self.error(msg, *args, **kwargs)
File "/usr/lib/python3.3/logging/", line 1262, in error
self._log(ERROR, msg, args, **kwargs)
File "/usr/lib/python3.3/logging/", line 1368, in _log
File "/usr/lib/python3.3/logging/", line 1377, in handle
if (not self.disabled) and self.filter(record):
File "/usr/lib/python3.3/logflask_wtf
wtformsging/", line 687, in filter
for f in self.filters:
File "/bin/", line 59, in __call__
app_iterator =, start_response)
File "/bin/", line 73, in import_error_application
raise e
File "/bin/", line 82, in <module>
application = load_wsgi_application()
File "/bin/", line 78, in load_wsgi_application
return __import__(os.environ['WSGI_MODULE'], globals(), locals(), ['application']).application
File "/var/www/", line 16, in <module>
from import app as application
File "/home/rcham/mysite/addressbook/", line 4, in <module>
from addressbook.forms import LoginForm, ContactsForm
File "/home/rcham/mysite/addressbook/", line 1, in <module>
from import Form
File "/usr/local/lib/python3.3/dist-packages/flask/", line 87, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named

ls /home/rcham/.local/lib/python2.7/site-packages/flask globals.pyc logging.pyc signals.pyc
__init__.pyc blueprints.pyc debughelpers.pyc views.pyc ext helpers.pyc module.pyc templating.pyc
_compat.pyc config.pyc wrappers.pyc exthook.pyc json.pyc sessions.pyc testing.pyc
app.pyc ctx.pyc testsuite

ls /usr/local/lib/python3.3/dist-packages/ | grep wtf



According to the official quickstart, should be flask_wtf.

So you have to import it as

from flask_wtf import Form

At least I have, I installed from pip.