django-session-timeout
Middleware to expire sessions after specific amount of time
Decision gist · record as of 2026-08-14
Yes. The package is stable, actively maintained, has low install friction, carries no known vulnerabilities, and solves a common Django security need. MIT licensing imposes no restrictions. Install it if you need automatic session expiration; the configuration is straightforward and the middleware integrates cleanly into Django's standard session handling.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Django and six as runtime dependencies; must be added to Django's MIDDLEWARE_CLASSES configuration.
- Low friction installation with only 2 runtime dependencies.
- Actively maintained with recent commits; last update was 2026-04-28.
License · maintenance · safety
MIT (permissive) — MIT license is permissive, allowing commercial and private use with minimal restrictions.
last release 2020-03-08 (2350 days) · last repo commit 2026-04-28 · 37 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 77,369 downloads/mo, #14,531 on PyPI
Alternatives
Verify before relying
pip install django-session-timeout
# In settings.py, add to MIDDLEWARE_CLASSES:
'django_session_timeout.middleware.SessionTimeoutMiddleware',
# Set expiration time:
SESSION_EXPIRE_SECONDS = 3600- Whether the package supports Django versions released after 3.0 (classifiers list only through 3.0)
- Whether Python 3.8+ is supported (classifiers only list through 3.7)
What it is and what it does
django-session-timeout is a Django middleware that enforces automatic session expiration based on time. It adds timestamp tracking to sessions and can expire them either after a fixed duration from session creation or after a period of user inactivity. The middleware integrates into Django's standard session framework and requires minimal configuration—just adding it to MIDDLEWARE_CLASSES and setting SESSION_EXPIRE_SECONDS.
The package supports flexible expiration strategies: you can track inactivity with optional grace-period grouping to reduce database writes, and redirect expired sessions to a custom URL. It depends on Django and six, making it lightweight and compatible with existing Django projects.
Use it for
- Enforce security policies requiring user sessions to expire after a fixed time period in web applications.
- Log out inactive users automatically to reduce unauthorized access risk in shared or public-facing systems.
- Implement inactivity-based timeouts that reset on user activity to balance security with user experience.
- Redirect expired sessions to a login page or custom endpoint for graceful session termination.
- Group activity timestamps by different periods to reduce database load while tracking user inactivity.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is stable, actively maintained, has low install friction, carries no known vulnerabilities, and solves a common Django security need. MIT licensing imposes no restrictions. Install it if you need automatic session expiration; the configuration is straightforward and the middleware integrates cleanly into Django's standard session handling.
Install
django-session-timeout on PyPI
Before you install
Low friction installation with only 2 runtime dependencies. Actively maintained with recent commits; last update was 2026-04-28. Stable production release status.
Requires Django and six as runtime dependencies; must be added to Django's MIDDLEWARE_CLASSES configuration.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions.
Quickstart
pip install django-session-timeout
# In settings.py, add to MIDDLEWARE_CLASSES:
'django_session_timeout.middleware.SessionTimeoutMiddleware',
# Set expiration time:
SESSION_EXPIRE_SECONDS = 3600
Verify before relying
- Whether the package supports Django versions released after 3.0 (classifiers list only through 3.0)
- Whether Python 3.8+ is supported (classifiers only list through 3.7)
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesDjangosix |
| Maintenance | Actively maintained 2,350 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 77,369 / month, #14,531 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 2.0Framework :: Django :: 2.1Framework :: Django :: 2.2Framework :: Django :: 3.0License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7 |
Evidence: django_session_timeout-0.1.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django session expiration”
- django-session-timeoutAdds automatic session expiration to Django applications, allowing…
- django-user-sessionsReplaces Django's opaque session backend with queryable ORM objects…
- aiohttp-sessionProvides session management for aiohttp.web applications with…
Give your agent the search over MCP, or paste the wish link into any chat.
More Dynamic Content packages
MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.
Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.
Soupsieve is a CSS selector library designed to work with Beautiful Soup 4 to select, match, and filter HTML and XML elements using modern CSS selectors from CSS level 1 through CSS level 4 specifications.
Install it if you use Beautiful Soup for HTML or XML parsing and want modern CSS selector support.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
Flask is a lightweight WSGI web application framework for building web applications in Python, from simple single-page sites to complex multi-route applications.
Mako compiles Python-embedded templates into Python modules for fast rendering, supporting layout inheritance, custom functions, and direct Python expressions within template syntax.
See also expiring-dict · starsessions · django-crum · django-defender · expiringdict · django-cprofile-middleware · django-pgactivity · django-htmlmin · aiohttp-session