Django multiple databases, auto routers
# Install
pip install django-routers
# Usage
Add in settings:
DATABASE_ROUTERS = ['routers.router.AutoRouter']
## Settings example:
* Written server by **default**
* Reading server by **default** and **slave**
Example:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'routers',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '127.0.0.1',
},
'slave': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'routers_more',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '10.0.0.2',
}
}
DATABASE_ROUTERS = ['routers.router.AutoRouter']
## Advanced options
Settings Variables:
* ROUTERS_READ
* * Declares which server is reading
* ROUTERS_WRITE
* * Declares which server is written
* ROUTERS_ALLOW_RELATION
* * Declares whether we consulted on more than one database, default is **True**
Metadata
Release files for django-routers 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 | |
|---|---|---|---|---|
| django-routers-0.2.tar.gz | 2.2 kB | Without provenance | Details |
Release files / django-routers-0.2.tar.gz
| Download URL | django-routers-0.2.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eeb176cbb46a83454d96a5239e1bb1334914f7f5f595f4692f2684a0ee128fe6
|
|
BLAKE2b-256 checksum How to use checksums |
32fe4c23c1f4ed881460512e81963d3433b7b525793136193ca37d3af4de035a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-routers 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.