Skip to content
Discussion options

You must be logged in to vote

Well, session data contains user-specific information (like who is logged in), which is read from the request's cookies and saved to the response's cookies. If the session object itself were app-scoped (shared across the entire application/all users), everyone would share the same session, which isn't what we want.

The session object in BustAPI is a context-local proxy (similar to Flask's session) that dynamically points to the session of the active request. That's why it raises a RuntimeError if you try to access/modify it at the module level when no HTTP request is being handled.

If you want all sessions to be permanent, you can set it using a @app.before_request hook, which runs within…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@GrandpaEJ
Comment options

Answer selected by ockan
@ockan
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants