You can control whether the session framework uses browser-length sessions vs. persistent sessions with the SESSION_EXPIRE_AT_BROWSER_CLOSE
setting. By default, SESSION_EXPIRE_AT_BROWSER_CLOSE
is set to False
, which means session cookies will be stored in users' browsers for as long as SESSION_COOKIE_AGE
. Use this if you don't want people to have to log in every time they open a browser.
If SESSION_EXPIRE_AT_BROWSER_CLOSE
is set to True
, Django will use browser-length cookies-cookies that expire as soon as the user closes their browser.
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.