Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hellysmile/django-mongo-sessions
mongodb as Django sessions backend
https://github.com/hellysmile/django-mongo-sessions
Last synced: 29 days ago
JSON representation
mongodb as Django sessions backend
- Host: GitHub
- URL: https://github.com/hellysmile/django-mongo-sessions
- Owner: hellysmile
- License: apache-2.0
- Created: 2013-03-01T10:36:52.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-11-17T22:19:37.000Z (about 7 years ago)
- Last Synced: 2024-11-25T01:32:26.043Z (about 2 months ago)
- Language: Python
- Homepage: https://pypi.python.org/pypi/django-mongo-sessions
- Size: 15.6 KB
- Stars: 11
- Watchers: 6
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
django-mongo-sessions
=====================:info: mongodb as Django sessions backend
.. image:: https://api.travis-ci.org/hellysmile/django-mongo-sessions.png
:target: https://travis-ci.org/hellysmile/django-mongo-sessionsfeatures
********* 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 optionsecond, 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 timeevery 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