Skip to main content

Rest Session Backend For Django

Project description

Rest based sessions backend for Django.


This backend relies on rest-sessions for storing and managing sessions. Npm rest-sessions needs to be running and accessible at SESSION_URL.


This package relies on the requests package. Make sure it is installed in your Django project:
pip install requests


Install with pip:
pip install django-rest-sessions


After installing django-rest-sessions you must add a few settings to your

  • Add rest_sessions as your session engine:

    SESSION_ENGINE = 'rest_sessions'
  • Add django.contrib.sessions.middleware.SessionMiddleware to MIDDLEWARE_CLASSES

  • Add the name of the session cookie for Django’s session middleware:

    SESSION_COOKIE_NAME = 'session-cookie'
  • Add the path where npm rest-sessions is running:

    SESSION_URL = ''
  • Add the app that is used in npm rest-sessions:

    SESSION_APP = 'mywebapp'


This session backend is mostly intended to be used in a microservice architecture and thus does not handle creating sessions since npm rest-sessions requires a user key so it would only be possible to create a session within the microservice that takes care of the users for your application. Because this is intended to add sessions to requests to all microservices written in Django it is more applicable to create sessions once a user logs in or requests a web page and use this for services handling RESTful requests that said web page makes.


To run tests the following packages are needed:

  • django
  • requests
  • requests_mock
Install them with:
pip install -r requirements.txt
Run the tests with:
python test or python xml_test which generates an xml report

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-rest-sessions, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size django-rest-sessions-0.2.2.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page