New to flask and Flask-Login - ImportError: No module named login

Viewed 30203

It appears that installation of flask-login has issues. Despite a successful install using the below

 pip install flask-login

My app.py file:

 from flaskext.login import LoginManager
 lm = LoginManager()

I get this error :

ImportError: No module named login

So how do I resolve

5 Answers

There was yet another transition of the way Flask extensions are imported.

The Flask 0.8 style from flask.ext.login import … is no longer supported, and the even earlier style from flaskext.login import … is also no longer supported.

Use this way with Flask 1.0 or later:

from flask_login import LoginManager
Related