Monday, November 30, 2015

Set the default session expired time in Django

In Django, you can set the expired time of session by this setting, for example after 10 minutes:

SESSION_COOKIE_AGE = 10 * 60

In addition, if you want the session will be expired when the user closes her browser, you can set:

SESSION_EXPIRE_AT_BROWSER_CLOSE = True