Skip to main content

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-joinup

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_MAXIMUM_SECONDS:

SESSION_EXPIRE_MAXIMUM_SECONDS = 28800  # 8 hours

By default, the session will expire X seconds since the user do login.

SESSION_EXPIRE_SECONDS = 3600  # 1 hour

The session will expire X seconds after the start of the session or renew it. To renew the session X seconds after expire, use the following setting:

SESSION_EXPIRE_AFTER_LAST_ACTIVITY_GRACE_PERIOD = 1800  # 30 minutes

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

django-session-timeout-joinup-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

django_session_timeout_joinup-1.0.0-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-session-timeout-joinup-1.0.0.tar.gz.

File metadata

  • Download URL: django-session-timeout-joinup-1.0.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for django-session-timeout-joinup-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7a9218010623fba056a498ffb79c62121029d33fbe287008a88dfef9848ffbc6
MD5 52bb44eb56817a6492fe8ba65de9235a
BLAKE2b-256 a1fc610416f24a8e4a1e45be2068f605c9b78290feb8aa3f7415f62f4281d937

See more details on using hashes here.

Provenance

File details

Details for the file django_session_timeout_joinup-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_session_timeout_joinup-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for django_session_timeout_joinup-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7ab399ca53c3e61f4a5eeff3acd91dd1c002feb4a1b31debd31bed4841f05c73
MD5 efeff0574c6e82f0563bb9a321e361f0
BLAKE2b-256 6f07ce4dc8e8250e7b6f752a6f6d8d262a51ff1e757dacb7603597b3dd9cc95a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page