Simple database router was originally written for personal and work purposes.
Project description
Django auth DB router.
Simple database router that helps to split your main database and authentication database. This may be necessary, for example, when splitting a project into microservices.
Quickstart
-
Add
django_auth_db_router
to yourINSTALLED_APPS
setting like this:INSTALLED_APPS = [ ... 'django_auth_db_router', ... ]
-
Add
DATABASE_ROUTERS
setting insettings.py
file:DATABASE_ROUTERS = [ 'django_auth_db_router.routers.AuthRouter', ]
-
Add
auth_db
section toDATABASES
:DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'default.sqlite3', }, 'auth_db': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'auth.sqlite3', }, }
-
Finally, add
AUTH_DB
setting:DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'default.sqlite3', }, 'auth_db': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'auth.sqlite3', }, } AUTH_DB = 'auth_db'
Without this setting router will use
default
db connection.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-auth-db-router-0.1.5.tar.gz
.
File metadata
- Download URL: django-auth-db-router-0.1.5.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0rc2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 049dc19b28d655aee4120881b3ce93906924855ad742ded9c78c3c24dbb01a09 |
|
MD5 | fd391a440aaeda9b130b11e3c3491f39 |
|
BLAKE2b-256 | c80a42e29bae90bc8f16a2b749c6881ffbe6a3e2caf1f78bda0c5e155a1fabb7 |