Middleware to expire sessions after specific amount of time
Project description
django-session-timeout
Add timestamp to sessions to expire them independently
Installation
pip install django-session-timeout
Usage
Update your settings to add the SessionTimeoutMiddleware:
MIDDLEWARE_CLASSES = [
# ...
'django.contrib.sessions.middleware.SessionMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware',
# ...
]
And also add the SESSION_EXPIRE_SECONDS
:
SESSION_EXPIRE_SECONDS = 3600 # 1 hour
By default, the session will expire X seconds after the start of the session.
To expire the session X seconds after the last activity
, use the following setting:
SESSION_EXPIRE_AFTER_LAST_ACTIVITY = True
By default, last activiy
will be grouped per second.
To group by different period use the following setting:
SESSION_EXPIRE_AFTER_LAST_ACTIVITY_GRACE_PERIOD = 60 # group by minute
To redirect to a custom URL define the following setting:
SESSION_TIMEOUT_REDIRECT = 'your_redirect_url_here/'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-session-timeout-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 648fe4ffa762f3bb62ce7a9ed1bbba8e37648158d555f18a880471982941084c |
|
MD5 | 36120e3e3ed32c2b14b4bdfff5d58fed |
|
BLAKE2b-256 | 6f989b3330c7e54360a94a3fdc43526deba8b7339d72a4f8da35799d79c1f608 |
Close
Hashes for django_session_timeout-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e01b2502d4b9995edb93be1a66f304d0314cecb4f671ddc26cb4525a07e56282 |
|
MD5 | 99f3afac55189add5b2bdd05ae6477f4 |
|
BLAKE2b-256 | 7ff11166326c05ff647e32c3b71e6e1afe15272ad7d6c1fad101a9d798f6c2f2 |