from flask_login import LoginManager, UserMixin, login_user, logout_user, login_required from ..ext.models import User def init_app(app): login_manager = LoginManager(app) login_manager.init_app(app) login_manager.login_view = 'login' @login_manager.user_loader def load_user(user_id): return User.query.get(user_id)