Skip to main content

Django integration with litestream, a a standalone streaming replication tool for SQLite.

Project description

django-litestream

PyPI - Version PyPI - Python Version PyPI - Versions from Framework Classifiers MIT License

Django integration for Litestream, the SQLite replication tool. The Litestream binary is bundled in platform-specific wheels — no manual download needed. All upstream commands are available as python manage.py litestream <command>.

Note: This package tracks Litestream's upstream version. The initial release is 0.5.11, matching Litestream v0.5.11. Wrapper-only fixes (no Litestream update) use PEP 440 post-releases like 0.5.11.post1.

Installation

pip install django-litestream

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    "django_litestream",
]

The binary is installed automatically on supported platforms (Linux/macOS x86_64 & arm64). On unsupported platforms, set a custom path:

LITESTREAM = {
    "bin_path": "/usr/local/bin/litestream",
}

Configuration

Configuration is generated dynamically from Django settings — no YAML file needed.

# settings.py
LITESTREAM = {
    "path_prefix": "",      # prepended to S3 replica paths
    "bin_path": "...",      # custom binary path (optional)
    "dbs": [                # databases to replicate
        {"path": "default"},
    ],
}

All Litestream config options are supported (addr, logging, mcp-addr, access-key-id, etc.).

Database aliases

Use Django database aliases instead of file paths wherever db_path is required:

python manage.py litestream restore default        # instead of /path/to/db.sqlite3
python manage.py litestream sync default

Auto-generated replicas

If no replica is specified for a database, an S3 replica is auto-generated using environment variables:

LITESTREAM = {
    "dbs": [{"path": "default"}],
}
# Uses: LITESTREAM_REPLICA_BUCKET, LITESTREAM_ACCESS_KEY_ID, LITESTREAM_SECRET_ACCESS_KEY

Explicit replica config:

LITESTREAM = {
    "dbs": [
        {
            "path": "default",
            "replica": {
                "type": "s3",
                "bucket": "my-bucket",
                "path": "db.sqlite3",
            },
        },
    ],
}

Multiple databases with path_prefix

DATABASES = {
    "default": {"ENGINE": "django.db.backends.sqlite3", "NAME": BASE_DIR / "db.sqlite3"},
    "cache":  {"ENGINE": "django.db.backends.sqlite3", "NAME": BASE_DIR / "cache.sqlite3"},
}

LITESTREAM = {
    "path_prefix": "myproject",
    "dbs": [
        {"path": "default"},           # → myproject/db.sqlite3
        {
            "path": "cache",
            "replica": {
                "type": "s3",
                "bucket": "my-cache-bucket",
                "path": "cache.sqlite3",
            },
        },
    ],
}

Custom commands

These commands are unique to django-litestream — they don't exist in upstream Litestream.

litestream config

Display the generated configuration in YAML format.

python manage.py litestream config

Useful for verifying your setup before running replication.

litestream verify

Checks backup integrity end-to-end: writes a verification row, waits for replication, restores the latest backup, and confirms the row exists.

python manage.py litestream verify default

Upstream commands

All Litestream commands are exposed as management commands. Run python manage.py litestream to see the full list. Key notes:

  • replicate: Run in production via a process manager. Use -exec to wrap your application server.
  • restore: Supports -timestamp, -generation, -index for point-in-time recovery.
  • Daemon control (info, list, register, unregister, start, stop): Communicate with a running replicate daemon over IPC.

The only difference from upstream is that Django database aliases work anywhere db_path is expected.

VFS Read Replicas

Read-only access to cloud-stored replicas without downloading the entire database. Pages are fetched on-demand.

pip install django-litestream[vfs]

This installs both django-litestream and django-litestream-vfs (the VFS extension and Python integration).

Setup

# settings.py
from django_litestream_vfs import get_vfs_databases

LITESTREAM = {
    "dbs": [{"path": "default"}],
    "vfs": {
        "prod_replica": "s3://mybucket/db.sqlite3",
    },
}

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": BASE_DIR / "db.sqlite3",
    },
    **get_vfs_databases(),  # adds VFS replicas
}

Usage

User.objects.using("prod_replica").all()  # read-only, on-demand page fetch

VFS replicas are read-only. Only x86_64 and arm64 supported. Multiple storage backends supported (S3, GCS, Azure Blob).

License

MIT. The bundled Litestream binary uses the Apache 2.0 license.

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_litestream-0.5.13.tar.gz (10.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

django_litestream-0.5.13-py3-none-win_arm64.whl (36.3 MB view details)

Uploaded Python 3Windows ARM64

django_litestream-0.5.13-py3-none-win_amd64.whl (39.7 MB view details)

Uploaded Python 3Windows x86-64

django_litestream-0.5.13-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.whl (38.7 MB view details)

Uploaded Python 3musllinux: musl 1.1+ x86-64

django_litestream-0.5.13-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.whl (35.9 MB view details)

Uploaded Python 3musllinux: musl 1.1+ ARM64

django_litestream-0.5.13-py3-none-macosx_11_0_arm64.whl (37.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

django_litestream-0.5.13-py3-none-macosx_10_9_x86_64.whl (39.8 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

django_litestream-0.5.13-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file django_litestream-0.5.13.tar.gz.

File metadata

  • Download URL: django_litestream-0.5.13.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_litestream-0.5.13.tar.gz
Algorithm Hash digest
SHA256 7f0c383cca0ecad2e44d6a9e9fd1c0ad1863dc790833aa7a0eae741bfd47b3ef
MD5 60895f0edc64e0f389374237ffa9febc
BLAKE2b-256 12acd0ed310f3b669b0d440bf1fe38d77ce0433b353cee43ab98ee96520784a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_litestream-0.5.13.tar.gz:

Publisher: publish.yml on Tobi-De/django-litestream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_litestream-0.5.13-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for django_litestream-0.5.13-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 58058aaf1e50d1a80ec4526bba20f7d6d3c769ffd7229d3cf89c33fc617d283e
MD5 3d64736e9393fe32c5d257fac973ed97
BLAKE2b-256 0557b58459e4028622ecc733379ea147c39a5bb5dacd12197e6d67d8b0d293f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_litestream-0.5.13-py3-none-win_arm64.whl:

Publisher: publish.yml on Tobi-De/django-litestream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_litestream-0.5.13-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for django_litestream-0.5.13-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2a4cfe0a275bc787d2b6d8df024e90156c61cddf57570b6d7b8b6683de3dd26d
MD5 63c99993477c544ae21d3ab2ca9efcd6
BLAKE2b-256 6c3e808f99f215ae4c4d81bbf1c5d765c1f89a7eebd9f67d26e0c2bea4c85168

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_litestream-0.5.13-py3-none-win_amd64.whl:

Publisher: publish.yml on Tobi-De/django-litestream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_litestream-0.5.13-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for django_litestream-0.5.13-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b3b28974ac7724b7c466fd4f96464d0b09616b3cf2e795b8fbec3b7985be4a83
MD5 4bfdd004388f8485cf4f76ac87fada22
BLAKE2b-256 640baaa5501fcc315ce62b4970fcddd4bca6d489e36361b9976a54c92adc89c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_litestream-0.5.13-py3-none-manylinux2014_x86_64.musllinux_1_1_x86_64.whl:

Publisher: publish.yml on Tobi-De/django-litestream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_litestream-0.5.13-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for django_litestream-0.5.13-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 0db558c26aa2b6fa6d5c1baccf03113fec00928c6c0e4d8b6417726e2b3e0d9c
MD5 0551f1e6393b33a1afecb96925f11d5f
BLAKE2b-256 00ce667e36df5ef96315657447889b7249b06738320d1a965d6d763bbe7f05d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_litestream-0.5.13-py3-none-manylinux2014_aarch64.musllinux_1_1_aarch64.whl:

Publisher: publish.yml on Tobi-De/django-litestream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_litestream-0.5.13-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for django_litestream-0.5.13-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ff89253dd25b21c22fe011e4e74cf98029cf4b1b82ab6b3fcfcdd5e98aa112c
MD5 25d6648d4a858d3e07d3e38375805992
BLAKE2b-256 dc89cfc4435160df2e3a6c16404976fb4a61e8ab4bca408d633ce1f3b15004a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_litestream-0.5.13-py3-none-macosx_11_0_arm64.whl:

Publisher: publish.yml on Tobi-De/django-litestream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_litestream-0.5.13-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for django_litestream-0.5.13-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b63963281f075b3c036cc36e3a25cffc35dc52813da8c37d6ec60fa15fc1f602
MD5 bf1de422c90d30c05530ee0b3a621840
BLAKE2b-256 fa5c698db2123bddc012242b8f9235c8aae2ae0c1ca0392977ba0250ce7bd569

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_litestream-0.5.13-py3-none-macosx_10_9_x86_64.whl:

Publisher: publish.yml on Tobi-De/django-litestream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_litestream-0.5.13-py3-none-any.whl.

File metadata

File hashes

Hashes for django_litestream-0.5.13-py3-none-any.whl
Algorithm Hash digest
SHA256 9341a40a0255bb789dabfc2bff6828aef693c8f7fcb5005dc57816791761f7d5
MD5 4373f4a7acdf05cfa9f56fe685462d52
BLAKE2b-256 231969920dbdeadd325b9ee9c0ca0052d11e0ac0a1e491b30d4c5e9f3fae43d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_litestream-0.5.13-py3-none-any.whl:

Publisher: publish.yml on Tobi-De/django-litestream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page