Skip to main content

Simple database router that helps to implement microservices architecture with Django.

Project description

Django microservice auth SDK

Django auth DB router.

Simple database router that helps to split your main database and authentication database. This may be necessary when splitting a project into microservices. Let's say you have some Django project and want to split it into microservices. But all of your microservices need to use the same authentication database. This router will help you to do that.


How it works

Django project that provides authentication also shares some database with other microservices. Other microservices may have their own databases, but they all use the same authentication database. Let's look how this scheme looks like:

How it works

This is an example from dj-ms project. Follow the link to explore more.

Quickstart

Add ms_auth_router to your INSTALLED_APPS setting like this:

INSTALLED_APPS = [
    ...,
    'ms_auth_router',
    ...
]

Add DATABASE_ROUTERS setting in settings.py file or append to existing list:

DATABASE_ROUTERS = [
    'ms_auth_router.routers.DefaultRouter',
    ...
]

Add auth_db section to DATABASES:

DATABASES = {
   ...
   'auth_db': {
       'ENGINE': 'django.db.backends.sqlite3',
       'NAME': BASE_DIR / 'auth.sqlite3',
   },
   ...
}

Finally, add AUTH_DB setting:

AUTH_DB = 'auth_db'

Without this setting router will use default db connection.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dj-ms-auth-router-1.4.0.tar.gz (184.6 kB view hashes)

Uploaded Source

Built Distribution

dj_ms_auth_router-1.4.0-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page