Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named flask.ext.login

I have a problem with flask_login module.

i have installed flask_login module successfully. Also from the command prompt i can run this script easily with no error:

Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from flask.ext.login import LoginManager 

But when I am running this script:

from flask import Flask from flask.ext.login import LoginManager app = Flask(__name__)  @app.route("/") def hello():     return "Hello World! Welcome"  if __name__ == "__main__":     app.run() 

i am getting the error :

ImportError: No module named flask.ext.login 

What is the mistake i am doing. I am very new to this flask. Thanks in advance.

like image 719
curiousguy Avatar asked Feb 11 '14 11:02

curiousguy


1 Answers

If following does not work:

from flask.ext.login import LoginManager 

try the following:

from flask_login import LoginManager 

This is the new convention.

To find the flask-login version, you can run the following command in terminal. Just change the name to know the version of other packages.

pip show flask-login 
like image 102
prem kumar Avatar answered Sep 28 '22 02:09

prem kumar