Registry / web-framework / django-session-timeout

django-session-timeout

JSON →
library0.1.0pypypiunverified

Middleware for Django that automatically expires user sessions after a configurable period of inactivity. Version 0.1.0 is the latest, with an unpredictable release cadence.

pip install django-session-timeout
INSTALL
IMPORT
SIG · DJANGO-SESSION-TIM
D
django-session-timeout
web-frameworkpythonv0.1.0
Install
3.4s avg
Import
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.4s · import 0.000s · 67MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SessionTimeoutMiddleware
from django_session_timeout import SessionTimeoutMiddleware
from django_session_timeout import SessionTimeoutMiddleware

Add SessionTimeoutMiddleware after AuthenticationMiddleware and set SESSION_EXPIRE_SECONDS in settings.

from django_session_timeout import SessionTimeoutMiddleware MIDDLEWARE = [ # ... 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django_session_timeout.middleware.SessionTimeoutMiddleware', # ... ] # settings.py SESSION_EXPIRE_SECONDS = 3600 # 1 hour SESSION_TIMEOUT_REDIRECT = '/login/' # optional, default '/accounts/login/'
Debug
Known issues
breakingorder of middleware matters: SessionTimeoutMiddleware must be placed after AuthenticationMiddleware and SessionMiddleware.
fix
Ensure your MIDDLEWARE list has 'django_session_timeout.middleware.SessionTimeoutMiddleware' after 'django.contrib.sessions.middleware.SessionMiddleware' and 'django.contrib.auth.middleware.AuthenticationMiddleware'.
affects: >=0.1.0
gotchaSESSION_EXPIRE_SECONDS is required, but no default is provided. If not set, all sessions may expire immediately or cause unexpected behavior.
fix
Explicitly set SESSION_EXPIRE_SECONDS in your Django settings, e.g., SESSION_EXPIRE_SECONDS = 1800.
affects: >=0.1.0
gotchaThe middleware does not respect Django's SESSION_COOKIE_AGE; it uses its own setting SESSION_EXPIRE_SECONDS.
fix
If you want consistent session timeout, set both SESSION_COOKIE_AGE and SESSION_EXPIRE_SECONDS to the same value.
affects: >=0.1.0
Upgrade
Version history
0.1.0latest on PyPI · released Mar 8, 2020
Audit
Dependencies
djangorequiredCore framework requirement
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
django-session-timeout — pip install django-session-timeout · libregistry