Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Django middleware application to timeout a logged in user session after a specified time period
Python
branch: master

This branch is 27 commits ahead of subhranath:master

Merge pull request #5 from maestrofjp/master

Session keep alive ping breaks if l10n is on and use_thousands_separator=True
latest commit 34879064e7
@tzulberti authored

README.md

django-session-idle-timeout

A Django middleware application to timeout a logged in user session after a specified time period. A django message will be issued if the session gets timed out.

Requirements

Make sure the following Django apps and middlewares are enabled:

INSTALLED_APPS += (
    'django.contrib.auth',
    'django.contrib.sessions',
    'django.contrib.messages',
)
MIDDLEWARE_CLASSES += (
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)

Installation instructions

Install django-session-idle-timeout

easy_install django-session-idle-timeout

or

pip install django-session-idle-timeout

Installed apps

INSTALLED_APPS += (
    'django-session-idle-timeout',
)

Middleware

MIDDLEWARE_CLASSES += (
    'django-session-idle-timeout.middleware.SessionIdleTimeout',
)

Settings

SESSION_IDLE_TIMEOUT defines the period after which the session gets timed out in seconds. The default value is 30min.

SESSION_IDLE_TIMEOUT = 1800

Keepalive Ping

Keeps the session alive as long as the browser window is opened using a javascript ping.

Urls

Add to your urls.py e.g.:

urlpatterns += (
    url(r'^django-session-idle-timeout/', include('django-session-idle-timeout.urls')),
)

Template

Load the keepalive template tag to start the javascript polling:

{% session_keep_alive %}
{% load session_keep_alive %}

Important

This is a fork of http://github.com/subhranath/django-session-idle-timeout

Something went wrong with that request. Please try again.