【发布时间】:2012-12-14 05:21:23
【问题描述】:
我尝试实现 GAE 的 webapp2 会话,但是关于它的文档似乎很少。根据http://webapp-improved.appspot.com/api/webapp2_extras/sessions.html,我的步骤如下:
1.配置并添加配置到主应用程序:
config = {}
config['webapp2_extras.sessions'] = {
'secret_key': 'my_secret_key',
}
app = webapp2.WSGIApplication([...], config=config)
2.在登录处理程序中创建会话
# Delete existent session
--> not mention in the tutorial
# member is found
self.session_store = sessions.get_store(request=handler.request)
self.session['account'] = member.account
3.检查我程序中不同位置是否存在会话
if self.session['account']:
# Session exists
4.用户注销时删除会话
--> not mentioned in the tutorial
我的问题:
我在会话创建过程中收到错误消息“...对象没有属性'会话'”(步骤 2)
如何在第 2 步和第 4 步中删除会话?
整个会话管理流程是否正确?
谢谢。
【问题讨论】:
标签: google-app-engine session webapp2