Metadata-Version: 2.4
Name: django-session-timeout-2025
Version: 0.1.1
Summary: Middleware to expire sessions after specific amount of time
Home-page: https://github.com/nunombispo/django-session-timeout-2025
Author: Nuno Bispo
Author-email: nunombispo@gmail.com
License: MIT
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.0
Classifier: Framework :: Django :: 3.1
Classifier: Framework :: Django :: 3.2
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=3.0
Requires-Dist: six>=1.12
Provides-Extra: docs
Requires-Dist: sphinx>=1.8.4; extra == "docs"
Provides-Extra: test
Requires-Dist: coverage[toml]==5.0.3; extra == "test"
Requires-Dist: freezegun==0.3.15; extra == "test"
Requires-Dist: pytest==5.3.5; extra == "test"
Requires-Dist: pytest-django==3.8.0; extra == "test"
Requires-Dist: pytest-cov==2.8.1; extra == "test"
Requires-Dist: isort[pyproject]==4.3.21; extra == "test"
Requires-Dist: flake8==3.7.9; extra == "test"
Requires-Dist: flake8-blind-except==0.1.1; extra == "test"
Requires-Dist: flake8-debugger==3.1.0; extra == "test"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: summary


# django-session-timeout-2025

Add timestamp to sessions to expire them independently

## Installation

```shell
pip install django-session-timeout-2025
```

## Usage

Update your settings to add the SessionTimeoutMiddleware:

```python
MIDDLEWARE_CLASSES = [
    # ...
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django_session_timeout.middleware.SessionTimeoutMiddleware',
    # ...
]
```

And also add the `SESSION_EXPIRE_SECONDS`:

```python
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:

```python
SESSION_EXPIRE_AFTER_LAST_ACTIVITY = True
```

By default, `last activity` will be grouped per second.
To group by different period use the following setting:

```python
SESSION_EXPIRE_AFTER_LAST_ACTIVITY_GRACE_PERIOD = 60 # group by minute
```

To redirect to a custom URL define the following setting:

```python
SESSION_TIMEOUT_REDIRECT = 'your_redirect_url_here/'
```
