Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Extension to doc for 0.3/sessions #41

Merged
merged 1 commit into from

2 participants

@samkaufman

Hi.

I added a paragraph describing the interference between sessions and the reloader, and mentioned the standard web.config storage hack. Think this will save many a padawan much time.

@aaronsw aaronsw merged commit 5ab2b05 into webpy:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 1 deletion.
  1. +12 −1 docs/0.3/sessions.md
View
13 docs/0.3/sessions.md
@@ -60,4 +60,15 @@ The following code shows how to use a basic DiskStore session.
if __name__ == '__main__':
- app.run()
+ app.run()
+
+
+## Sessions and Reloading/Debug Mode
+Is your session data disappearing for seemingly no reason? This can happen when using the web.py app reloader (local debug mode), which will not persist the session object between reloads. Here's a nifty hack to get around this.
+
+ # Hack to make session play nice with the reloader (in debug mode)
+ if web.config.get('_session') is None:
+ session = web.session.Session(app, db.SessionDBStore())
+ web.config._session = session
+ else:
+ session = web.config._session
Something went wrong with that request. Please try again.