Django router for apps with more than 1 database
Project description
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
License
Copyright © 2019, Piotr Roszatycki
This software is distributed under the GNU Lesser General Public License (LGPL 3 or greater).
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
Built Distribution
Close
Hashes for django-database-for-apps-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 909352dffd3eb07a52fb002a2e5ac037c646e5b6a0e2d9194556945d92407465 |
|
MD5 | 66573959f47a4a975450b71f2873d571 |
|
BLAKE2b-256 | e37477ad22f96bbe31e4875c69a2f5ca9a5846af9bfd2d9272c1541831a16e07 |
Close
Hashes for django_database_for_apps-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5137da047028832e7cb69efcf9ed2694c8f0d04c341b33121d1c83c8259c901 |
|
MD5 | 599c451fbda96c901b0ee2859a2f784c |
|
BLAKE2b-256 | 1ba6793a1cf4df14ece02057d70dae558336270b730705735229a224bb22917e |