因为web应用会跑在公共电脑上,所以本来是希望用户关闭浏览器后必须重新登陆的。
设置 SESSION_EXPIRE_AT_BROWSER_CLOSE = True
结果在chrome下测试和firefox下结果不同!
去官网查文档https://docs.djangoproject.com/en/1.5/topics/http/sessions/#browser-length-sessions-vs-persistent-sessions
得到如下:
Some browsers (Chrome, for example) provide settings that allow users to continue browsing sessions after closing and re-opening the browser. In some cases, this can interfere with the SESSION_EXPIRE_AT_BROWSER_CLOSE setting and prevent sessions from expiring on browser close. Please be aware of this while testing Django applications which have the SESSION_EXPIRE_AT_BROWSER_CLOSE setting enabled.
设置 SESSION_EXPIRE_AT_BROWSER_CLOSE = True
结果在chrome下测试和firefox下结果不同!
去官网查文档https://docs.djangoproject.com/en/1.5/topics/http/sessions/#browser-length-sessions-vs-persistent-sessions
得到如下:
Some browsers (Chrome, for example) provide settings that allow users to continue browsing sessions after closing and re-opening the browser. In some cases, this can interfere with the SESSION_EXPIRE_AT_BROWSER_CLOSE setting and prevent sessions from expiring on browser close. Please be aware of this while testing Django applications which have the SESSION_EXPIRE_AT_BROWSER_CLOSE setting enabled.