Installing Flask-Login
Flask-Login is a lightweight extension that handles logging users in and out of the site. From the project's documentation, Flask-Login will do the following:
- Log users in and out of the site
- Restrict views to the logged-in users
- Manage cookies and the "remember me" functionality
- Help protect user session cookies from being stolen
On the other hand, Flask-Login will not do the following:
- Make any decisions about the storage of user accounts
- Manage usernames, passwords, OpenIDs, or any other form of credentials
- Handle tiered permissions or anything beyond logged in or logged out
- Account registration, activation, or password reminders
The takeaway from these lists is that Flask-Login can best be thought of as a session manager. It simply manages user sessions and lets us know which user is making a request, and whether that user is logged in or not.
Let's get started. Use pip
to install Flask-Login:
(blog) $ pip install Flask-Login Downloading/unpacking Flask...