0

因此,我一直在尝试将 Janrain Engage 插件实施到我正在开发的应用程序(Google App Engine (Python 2.7))中,使用 GAESessions 作为会话库。

按照GAESessions 页面上的说明,我在应用程序的根目录中创建了“gaesessions”文件夹(包含“__init__.py”)和“appengine_config.py”,以及处理插件的相关文件。

然而,尝试通过 Janrain 登录时,我抛出了一个 500 错误,并在 GAE 日志中给了我这个回溯:

E 2013-03-25 07:06:55.535

'thread._local' object has no attribute 'current_session'
Traceback (most recent call last):
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1536, in __call__
    rv = self.handle_exception(request, response, e)
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1530, in __call__
    rv = self.router.dispatch(request, response)
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/base/data/home/apps/s~k-sketch-test/10.366190612177083948/rpx.py", line 56, in post
    session = get_current_session()
  File "/base/data/home/apps/s~k-sketch-test/10.366190612177083948/gaesessions/__init__.py", line 38, in get_current_session
    return _tls.current_session
AttributeError: 'thread._local' object has no attribute 'current_session'

我已经搜索了有关“get_current_session()”问题的其他 帖子,但它们似乎引用的是“local”而不是“thread._local”。

关于这里发生了什么的任何想法?提前致谢!

========

{根文件夹}/appengine_config.py

from gaesessions import SessionMiddleware

import os
COOKIE_KEY = '<hidden - was generated through os.urandom(64)>'

def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = SessionMiddleware(app, cookie_key=COOKIE_KEY)
  app = recording.appstats_wsgi_middleware(app)
  return app

========

4

1 回答 1

1

{root 文件夹}/appengine_config.py文件 appengine_config.py 是否在根位置?

aaps/app.yaml
    /main.py
    /appengine_config.py
    /gaesessions #folder

可以看gaesessions的基本教程

于 2013-08-27T17:56:47.050 回答