Django: Session Cache not updated when using Cookie Based Session Storage

梦想的初衷 提交于 2019-12-04 18:53:16

According to the Django Documentation:

https://docs.djangoproject.com/en/1.6/topics/http/sessions/#when-sessions-are-saved

By default, Django only saves to the session database when the session has been modified – that is if any of its dictionary values have been assigned or deleted

request.session.modified = True

To change this default behavior, set the SESSION_SAVE_EVERY_REQUEST setting to True. When set to True, Django will save the session to the database on every single request.

Note that the session cookie is only sent when a session has been created or modified. If SESSION_SAVE_EVERY_REQUEST is True, the session cookie will be sent on every request.

Similarly, the expires part of a session cookie is updated each time the session cookie is sent.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!