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',
    ...
]

Configure DB routers:

DATABASE_ROUTERS = [
    'django_database_for_apps.Router'
]

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.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

django_database_for_apps-0.1.1-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-database-for-apps-0.1.1.tar.gz.

File metadata

  • Download URL: django-database-for-apps-0.1.1.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.3

File hashes

Hashes for django-database-for-apps-0.1.1.tar.gz
Algorithm Hash digest
SHA256 909352dffd3eb07a52fb002a2e5ac037c646e5b6a0e2d9194556945d92407465
MD5 66573959f47a4a975450b71f2873d571
BLAKE2b-256 e37477ad22f96bbe31e4875c69a2f5ca9a5846af9bfd2d9272c1541831a16e07

See more details on using hashes here.

File details

Details for the file django_database_for_apps-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: django_database_for_apps-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.3

File hashes

Hashes for django_database_for_apps-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d5137da047028832e7cb69efcf9ed2694c8f0d04c341b33121d1c83c8259c901
MD5 599c451fbda96c901b0ee2859a2f784c
BLAKE2b-256 1ba6793a1cf4df14ece02057d70dae558336270b730705735229a224bb22917e

See more details on using hashes here.

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