User Loader and the UserMixin
Configure the LoginManager and user model.
Meet Flask-Login
The Flask-Login extension manages who is logged in for you. It tracks the current user across requests so you do not wire sessions by hand.
pip install flask-loginCreate a LoginManager
Everything starts with a LoginManager. You create one instance and connect it to your app so Flask-Login can hook into requests.
from flask_login import LoginManager
login_manager = LoginManager()
login_manager.init_app(app)All lessons in this course
- Hash Passwords, Never Store Plaintext
- User Loader and the UserMixin
- login_user, logout_user, and Sessions
- Protect Views with login_required