そこで、セッション ライブラリとして GAESessions を使用して、作業中のアプリケーション (Google App Engine (Python 2.7)) に Janrain Engage プラグインを実装しようとしました。
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()」の問題に関する他の 投稿を検索しましたが、「thread._local」ではなく「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
========