Skip to main content

Django router for apps with more than 1 database

Project description

https://img.shields.io/pypi/v/django-database-for-apps.svg https://travis-ci.org/dex4er/django-database-for-apps.svg?branch=master https://readthedocs.org/projects/django-database-for-apps/badge/?version=latest https://img.shields.io/pypi/pyversions/django-database-for-apps.svg https://img.shields.io/pypi/djversions/django-database-for-apps.svg

django-database-for-apps

django-database-for-apps is a package that provides a router which chooses a database based on app name.

Installation

Install with pip or pipenv:

pip install django-database-for-apps

Add django_database_for_apps to your installed apps in your settings.py file:

INSTALLED_APPS = [
    'django_database_for_apps',
    ...
]

Configuration

# list of apps and theirs database
DATABASE_FOR_APPS = {
    'test_project': 'default',
    '*': 'django',
}

* matches all applications so the default database might be redefined from 'default' to something else.

Optional

# allows relations between databases (default: None)
DATABASE_FOR_APPS_RELATIONS = True

Documentation

See http://django-database-for-apps.readthedocs.org/

License

Copyright © 2019, Piotr Roszatycki

This software is distributed under the GNU Lesser General Public License (LGPL 3 or greater).

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

django-database-for-apps-0.1.0.tar.gz (16.0 kB view hashes)

Uploaded Source

Built Distribution

django_database_for_apps-0.1.0-py2.py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 2 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