Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session variables do not persist between refreshes #49

Open
MeLight opened this issue Oct 17, 2013 · 2 comments
Open

Session variables do not persist between refreshes #49

MeLight opened this issue Oct 17, 2013 · 2 comments

Comments

@MeLight
Copy link

MeLight commented Oct 17, 2013

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

@mdornseif
Copy link
Contributor

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

@MeLight
Copy link
Author

MeLight commented Nov 3, 2013

Yeap I have. Apparently it's a Google Chrome problem - because it works well on FF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants