flask-login can not be used in Blueprint object? flask-login can not be used in Blueprint object? flask flask

flask-login can not be used in Blueprint object?


It is also possible to LoginManager.setup_app() on Blueprint's registration:

admin = Blueprint('admin', __name__)login_manager = LoginManager()@admin.record_oncedef on_load(state):    login_manager.init_app(state.app)

on_load will be run when the Blueprint is first registered to the app.


That's why it called setup_app

Just move initialization to your run.py and pass app as parameterAnd login itself can stay inside admin blueprint