Can't import csrf module from within flask_wtf

Hi there,

I use flask_wtf to help do form validation. For some reason, when I run the init file on my web app I get the following response:

Traceback (most recent call last):
File "/home/...../", line 9, in <module>
from flask_wtf.csrf import CsrfProtect
ImportError: No module named csrf

Can't quite work out why. Any ideas?? PS I have already tried importing flask_wtf in the bash console and this doesn't make any difference. PPS I don't encounter this issue when running on my own local host with flask_wtf installed.

Just for fun I thought I'd try the solution posed for the missing Cairo module This is the resulting error message:

Traceback (most recent call last):
File "/home/.../", line 10, in <module>
AttributeError: 'module' object has no attribute 'use'

I think it's because our default version of flask-wtf is a little out of date. You can upgrade it with:

pip install --user --upgrade flask-wtf

Or look into using a virtualenv (instructions refer to django, but you should be able to adapt them to flask...)

Hi Harry,

Thanks for that, it works a charm with the upgrade : )

thank you Harry, you save my night. the problem was update.