gae-sessions
gae-sessions copied to clipboard
Session variables do not persist between refreshes
The most basic functionality seems to cease working. This snippet shows counter: 1
no matter how many times I refresh.
import webapp2
import sys
sys.path.insert(0, 'libs')
from libs.gaesessions import get_current_session
class TestGaeHandler(webapp2.RequestHandler):
def get(self):
self.post()
def post(self):
session = get_current_session()
c = session.get('counter', 0)
session['counter'] = c+1
counter = session['counter']
self.response.headers['Content-Type'] = 'text/html; charset=UTF-8'
self.response.write('counter: '+str(counter))
app = webapp2.WSGIApplication([
('/api/service/test_gae', TestGaeHandler)
], debug=True)
Please advise. Thanks
Did you enable sessions in appengine_config.py?
def webapp_add_wsgi_middleware(app):
"""Called with each WSGI handler initialisation"""
app = gaetk.gaesessions.SessionMiddleware(app, cookie_key=COOKIE_KEY)
return app
Yeap I have. Apparently it's a Google Chrome problem - because it works well on FF