gaesessions cant find 'current_session' at

2019-06-11 02:51发布

I'm using gaesessions. When I try to check the current sessions by doing get_current_session() I get the following error:

File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp\_webapp25.py", line 716, in __call__
    handler.post(*groups)
  File "C:\Users\roger\Documents\projects\myapp\handlers\unburden.py", line 502, in post
    session = get_current_session()
  File "C:\Users\roger\Documents\projects\myapp\gaesessions\__init__.py", line 37, in get_current_session
    return _tls.current_session
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\dist\_threading_local.py", line 215, in __getattribute__
    return object.__getattribute__(self, name)
AttributeError: 'local' object has no attribute 'current_session'

I have already created the appengine_config.py file, and here it is:

from gaesessions import SessionMiddleware

COOKIE_KEY = '\x91G{\xd8\x90\x1e\xa4\xfdcd\x0fd\x0cXt\xd4 d\x97\x06YV\xaa_\x99\x95\x9d\xbc&\x83\x98\xb4h\xa5\xc1\xdau\xd5\x03\xc6u\xc7\x15<!V\x9d\xd9\xef\xa4Z\xce\x7f\x06*i\xca\xd2\x9f\xcdE|\x1fV'

def webapp_add_wsgi_middleware(app):
    app = SessionMiddleware(app, cookie_key=COOKIE_KEY)
    return app

I created the COOKIE_KEY by running os.urandom(64) on an python interpreter. I don't know what might be causing this, since I've seen a question about this problem, and it says you must create the appengine_config.py file and configure the middleware, but it's already done.

OBS: I'm NOT using Python27 on my GAE application.

Any ideas? Thank you.

0条回答
登录 后发表回答