MasterStandbyRouter
-----------------
With ``standbydb.MasterStandbyRouter`` all read queries will go to a standby
database; all inserts, updates, and deletes will go to the ``default``
database.
First, define ``STANDBY_DATABASES`` in your settings. It should be a list of
database aliases that can be found in ``DATABASES``::
DATABASES = {
'default': {...},
'standby-1': {...},
'standby-2': {...},
}
STANDBY_DATABASES = ['standby-1', 'standby-2']
Then put ``standbydb.MasterStandbyRouter`` into DATABASE_ROUTERS::
DATABASE_ROUTERS = ('standbydb.MasterStandbyRouter',)
The standby databases will be chosen in round-robin fashion.
If you want to get a connection to a standby in your app, use
``standbydb.get_standby``::
from django.db import connections
import standbydb
connection = connections[standbydb.get_standby()]
Running the Tests
-----------------
To run the tests, you'll need to install the development requirements::
pip install -r requirements.txt
./run.sh test
Metadata
Release files for django-standbydb-router 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-standbydb-router-0.2.tar.gz | 3.6 kB | Without provenance | Details for django-standbydb-router-0.2.tar.gz |
Release files / django-standbydb-router-0.2.tar.gz
| Download URL | django-standbydb-router-0.2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77d425368a9f328701a5757371e9666cc63f2c0e2bb8f8f88177a311ab0d2cb6
|
|
BLAKE2b-256 checksum How to use checksums |
e2fda035988d77eadb76043bbeb0e64a0c1903ca88ce04dfe67e427b599ae0b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-standbydb-router 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.