当我尝试使用beaker为会话字典分配内容时,出现以下错误:
Traceback (most recent call last):
rv = callback(*a, **ka)
File "controllers.py", line 30, in login
s['email'] = email
TypeError: 'NoneType' object does not support item assignment
1.0.0.127.in-addr.arpa - - [12/Feb/2012 18:48:52] "POST /login HTTP/1.1" 500 746
,其中
s = bottle.request.environ.get('beaker.session')
我按照bottle FAQ上的教程。
答案 0 :(得分:6)
session_opts = {
'session.type': 'file',
'session.cookie_expires': 300,
'session.data_dir': './data',
'session.auto': True
}
myapp = SessionMiddleware(app, session_opts)
run(app=myapp)