https://stackoverflow.com/questions/41614970/what-is-the-default-django-session-lifetime-and-how-to-change-it
The setting you are looking for is SESSION_COOKIE_AGE, the default value is 1209600 which is two weeks, in seconds.
You can change the default Django session lifetime by setting SESSION_COOKIE_AGE to "settings.py" as shown below. By default, SESSION_COOKIE_AGE is 1209600 seconds(2 weeks):
# "settings.py"
SESSION_COOKIE_AGE = 180 # 3 minutes
Default: 1209600 (2 weeks, in seconds)
The age of session cookies, in seconds.
https://docs.djangoproject.com/en/4.2/topics/http/sessions/#:~:text=If%20value%20is%20an%20integer,at%20that%20specific%20date%2Ftime.
set_expiry(value)¶Sets the expiration time for the session. You can pass a number of different values:
- If
valueis an integer, the session will expire after that many seconds of inactivity. For example, callingrequest.session.set_expiry(300)would make the session expire in 5 minutes. - If
valueis adatetimeortimedeltaobject, the session will expire at that specific date/time. - If
valueis0, the user’s session cookie will expire when the user’s web browser is closed. - If
valueisNone, the session reverts to using the global session expiry policy.
No comments:
Post a Comment