Skip to main content

django-mongo-sessions

info:

mongodb as Django sessions backend

https://api.travis-ci.org/hellysmile/django-mongo-sessions.png

features

  • fast NoSQL Django sessions backend

  • invalidation via TTL

installation

run pip install django-mongo-sessions

set mongo_sessions.session as session engine:

SESSION_ENGINE = 'mongo_sessions.session'

settings

there is two ways to setup mongodb connection at settings.py

first, if already have mongo connection, like:

import pymongo
from pymongo import MongoClient
connection = MongoClient()
MONGO_CLIENT = connection.your_database
MONGO_SESSIONS_COLLECTION = 'mongo_sessions' # default option

second, if you need to connect to mongodb, like:

MONGO_PORT = 27017
MONGO_HOST = 'localhost'
MONGO_DB_NAME = 'test'
MONGO_DB_USER = False
MONGO_DB_PASSWORD = False
MONGO_SESSIONS_COLLECTION = 'mongo_sessions'

# all this settings are defaults, you can skip any

expireAfterSeconds index value by default is SESSION_COOKIE_AGE you can change:

MONGO_SESSIONS_TTL = 60 * 60 # one hour

be sure, that you know what are you doing with it, SESSION_COOKIE_AGE will get different expiration time

every time you change one of this values, expireAfterSeconds index will be dropped and then will be indexed with ensureIndex again, be careful here

it is good way to change expireAfterSeconds only by 1 running instance

tests

pip install tox
tox

Metadata

Release files for django-mongo-sessions 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-mongo-sessions 0.0.4
File Size Uploaded
django-mongo-sessions-0.0.4.tar.gz 7.8 kB Details

Release files / django-mongo-sessions-0.0.4.tar.gz

Download URL django-mongo-sessions-0.0.4.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b9e2b5661b12dd984af4a6e26a38e3054846ad3ea06af60bca878522f5599ced
BLAKE2b-256 checksum
How to use checksums
5b4bbb66c268f7f417360eb29b2f3244aaf9f9c1b7110b07b8a9528e97ee8148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page