Flask 3 · Templates, sessions and config
Remember a user between requests
Store values in the signed cookie session. It needs a secret key.
app.secret_key = os.environ["SECRET_KEY"]
session["user_id"] = user.id
Official Flask 3 documentation
More templates, sessions and config commands
- Render a template
- Loop in a template
- Share a layout
- Link to a static file
- Load configuration
- Show a one-time message
All templates, sessions and config commands · Flask 3 cheatsheet