djangoauthdbrouter 1.2.0
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 your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
'django_auth_db_router',
...
]
Add DATABASE_ROUTERS setting in settings.py file:
DATABASE_ROUTERS = [
'django_auth_db_router.routers.AuthRouter',
]
Add auth_db section to DATABASES:
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.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.