django-flyio
A set of simple utilities for Django apps running on Fly.io.
Note: This package is designed to work with V2 Apps. It has not been tested with V1 Apps.
Installation
pip install django-flyio
Usage
Multi-Region Fly Postgres
-
Set your
DATABASESsettings to callget_db_configfromdjango_flyio.db.This function reads the
PRIMARY_REGIONandFLY_REGIONenvironment variables to determine the Fly region the primary database is in and the Fly region the app is currently running in. -
Add
django_flyio.routers.FlyDBReplicaRouterto yourDATABASE_ROUTERSsettings.This router reads whether the
DATABASESsetting has areplicakey and, if so, routes reads to the replica database.
# settings.py
from django_flyio.db import get_db_config
DATABASES = get_db_config()
DATABASE_ROUTERS = ["django_flyio.routers.FlyDBReplicaRouter"]
Middleware
To set the Fly-Server header containing the Fly server and region that served the request, add django_flyio.middleware.FlyResponseMiddleware to your MIDDLEWARE settings.
# settings.py
MIDDLEWARE = [
# ...
'django_flyio.middleware.FlyResponseMiddleware',
]
License
django-flyio is distributed under the terms of the MIT license.
Metadata
Release files for django-flyio 0.1.1
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_flyio-0.1.1.tar.gz | 8.9 kB | Without provenance | Details for django_flyio-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_flyio-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for django_flyio-0.1.1-py3-none-any.whl |
Total release size: 14.0 kB
Release files / django_flyio-0.1.1.tar.gz
| Download URL | django_flyio-0.1.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f779a1dbc6071c913923cc89d887267ec1b77d03197779f69829a648db0de29f
|
|
BLAKE2b-256 checksum How to use checksums |
59f2823795ed51348ac29d37403e129af08eb25a005455ef46aefd92b1067fe8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.24.0
|
Release files / django_flyio-0.1.1-py3-none-any.whl
| Download URL | django_flyio-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ad00e1752cc1b19896fae027a60224cbbe49ee4bbbfaee3583a357f59c15715
|
|
BLAKE2b-256 checksum How to use checksums |
e82d3f36f91320b985ba387008d5961c4f522995f4cc28b4d2f28f66cdcda4cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.24.0
|
Security for django-flyio 0.1.1
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.