0
我正在開發一個本地主機上的cherrypy應用程序,並寫了這個來弄清楚會議上發生了什麼。cherrypy'tools.sessions.secure'似乎正在打破會話
import cherrypy
class WhyNotSessions(object):
@cherrypy.expose
def index(self):
if 'count' not in cherrypy.session:
cherrypy.session['count'] = 0
cherrypy.session['count'] += 1
return "Session count is %s" % cherrypy.session.get('count')
if __name__ == '__main__':
conf = {
'/': {
'tools.sessions.on': True,
'tools.sessions.secure': True
}
}
cherrypy.quickstart(WhyNotSessions(), '/', conf)
可正常工作,與count
遞增重新加載 - 只要我從conf
註釋掉'tools.sessions.secure': True
。我想更好地理解這裏發生的事情,因爲我打算在生產中使用安全會話。