如何在瓶子微框架中使用烧杯会话?
作者:互联网
当我尝试使用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的教程.
解决方法:
session_opts = {
'session.type': 'file',
'session.cookie_expires': 300,
'session.data_dir': './data',
'session.auto': True
}
myapp = SessionMiddleware(app, session_opts)
run(app=myapp)
标签:python,session,bottle,beaker 来源: https://codeday.me/bug/20190530/1184492.html