【发布时间】:2014-04-07 18:12:32
【问题描述】:
我尝试以下方法:
import cherrypy
#from cherrypy.lib import sessions
class HelloWorld(object):
@cherrypy.expose
def default(self, *args, **kwargs):
out = ''
for key, value in kwargs.items():
out += key + '=' + value + '\n'
cherrypy.session[key] = value
print cherrypy.session
return out
cherrypy.quickstart(HelloWorld())
结果我得到了
AttributeError: 'module' object has no attribute 'session'
我做错了什么?我尝试使用和不使用from cherrypy.lib import sessions。它在这两种情况下都不起作用。
【问题讨论】:
-
试试
cherrypy.config.update({"tools.sessions.on": True})
标签: python session web cherrypy