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

后端 未结 4 2285
太阳男子
太阳男子 2021-02-13 04:09

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

 pip install flask-login

My app.py file

4条回答
  •  忘掉有多难
    2021-02-13 04:45

    There was a transition of the flask extension import way:

    Instead we now recommend naming packages flask_foo instead of the now deprecated flaskext.foo. Flask 0.8 introduces a redirect import system that lets uses import from flask.ext.foo and it will try flask_foo first and if that fails flaskext.foo.

    Flask extensions should urge users to import from flask.ext.foo instead of flask_foo or flaskext_foo so that extensions can transition to the new package name without affecting users. (Source)

    Use this import way with Flask 0.8 or later:

    from flask.ext.login import LoginManager
    

提交回复
热议问题