简体   繁体   中英

gae-sessions 'thread._local' object has no attribute 'current_session'

I'm trying to get gae-sessions working, but am having an issue.

I've logged inside of appengine_config.py and inside of webapp_add_wsgi_middleware and it is being called.

I've logged inside the libs __init__.py and it's running __init__ , __call__ and my_start_response inside SessionMiddleware without issue.

My problem is that the second I try to actually use the session with:

session = get_current_session()

I get this:

    session = get_current_session()
  File "gaesessions\__init__.py", line 38, in get_current_session
    return _tls.current_session
AttributeError: 'thread._local' object has no attribute 'current_session'

Well the problem seems to be that I can only call get_current_session within a get request handler. If I try to call a function in another module from the get request handler, that itself requests the session, I get the above error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM