Skip to content

A simple Django Session Engine that uses Firestore as the database to store session data.

License

Notifications You must be signed in to change notification settings

resun-c/django-firestore-session-engine

Repository files navigation

Django Firestore Session Engine

This is a simple Django Session Engine that uses Firestore as the database to store session data.

Instalation

pip install django_firestore_session_engine

Setup & Usage

1. Add django_firestore_session_engine to the INSTALLED_APPS list in settings.

INSTALLED_APPS = [
    ...,
    'django_firestore_session_engine'
]

2. In settings, set SESSION_ENGINE to django_firestore_session_engine.engine

SESSION_ENGINE = 'django_firestore_session_engine.engine'

3. initialize a firestore collection and set it to FIRESTORE_SESSION_COL in settings.

FIRESTORE_SESSION_COL = FIRESTORE.collection("session")

Tips

Do not 'initialize' Firestore or 'import' initialized Firestore in more than one file while using it with Djnago. A good practice is to initialize firestore in the settings file and import it from there.

Acknowledgements

This Engine was made based on what is described in the Djnago documentation on How to use sessions and after some reverse-engineering of the existing session engines, especially the 'django.contrib.sessions.backends.db' and 'django.contrib.sessions.backends.file' engines.

Please send any comments and criticisms to the author here saif.resun@outlook.com

Cheers!

About

A simple Django Session Engine that uses Firestore as the database to store session data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages