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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-session-timeout-0.1.0.tar.gz.
File metadata
- Download URL: django-session-timeout-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
648fe4ffa762f3bb62ce7a9ed1bbba8e37648158d555f18a880471982941084c
|
|
| MD5 |
36120e3e3ed32c2b14b4bdfff5d58fed
|
|
| BLAKE2b-256 |
6f989b3330c7e54360a94a3fdc43526deba8b7339d72a4f8da35799d79c1f608
|
File details
Details for the file django_session_timeout-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: django_session_timeout-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e01b2502d4b9995edb93be1a66f304d0314cecb4f671ddc26cb4525a07e56282
|
|
| MD5 |
99f3afac55189add5b2bdd05ae6477f4
|
|
| BLAKE2b-256 |
7ff11166326c05ff647e32c3b71e6e1afe15272ad7d6c1fad101a9d798f6c2f2
|