Skip to main content

django-offsite-backup

CI PyPI Python

Off-site backups of a Django project's databases, media and deployment configuration: compressed, encrypted to a public key the server holds (so the server can write a backup and cannot read one), uploaded to S3 with Object Lock COMPLIANCE read back on every object, and rotated by whole nights — never by age alone, never by object count.

  • PostgreSQL (one database, a list, or a list computed at run time), plain or custom format
  • media from a directory, a Docker volume or an S3 bucket, in volumes of whole files
  • the deployment directory plus the environment rebuilt from a list of variable names
  • age encryption to one or more recipients; zstd compression before it
  • a pass before every deploy without media (fast, and never mistaken for a night)
  • a once-per-night guard, and a morning check that notices the night that never ran
  • every outcome said in Telegram (or through django-aiogram, or a log), in one glanceable format
  • restore that downloads, decrypts, verifies — and, on request, loads a database
  • system checks that refuse a half-configured machine by name and a bucket without a lock

Every backend is a dotted path in settings and imported only when named; each driver is an extra. A base install pulls Django and nothing else.

30-second setup

pip install "django-offsite-backup[s3,telegram]"
import os

INSTALLED_APPS = [..., 'offsite_backup']

OFFSITE_BACKUP = {
    'PREFIX': 'acme/prod',
    'ENV': 'prod',
    'STORE': {
        'BACKEND': 'offsite_backup.stores.s3.S3Store',
        'ENDPOINT_URL': os.environ.get('BACKUP_S3_ENDPOINT_URL', ''),
        'BUCKET': os.environ.get('BACKUP_S3_BUCKET', ''),
        'ACCESS_KEY': os.environ.get('BACKUP_S3_ACCESS_KEY', ''),
        'SECRET_KEY': os.environ.get('BACKUP_S3_SECRET_KEY', ''),
        'LOCK_DAYS': 13,
    },
    'ENCRYPTION': {
        'BACKEND': 'offsite_backup.encryption.age_cli.AgeCli',
        'RECIPIENTS': [os.environ.get('BACKUP_AGE_RECIPIENT', '')],
    },
    'DATABASES': {'BACKEND': 'offsite_backup.databases.postgres.PostgresSource'},
    'MEDIA': [{'BACKEND': 'offsite_backup.media.filesystem.DirectorySource'}],
    'CONFIG': {'BACKEND': 'offsite_backup.config.paths.PathsSource', 'PATHS': ['/app/deploy']},
    'RETENTION': {'KEEP_NIGHTS': 14},
    'NOTIFY': [
        {
            'BACKEND': 'offsite_backup.notifiers.telegram.TelegramNotifier',
            'TOKEN': os.environ.get('BACKUP_TG_TOKEN', ''),
            'CHAT_ID': os.environ.get('BACKUP_TG_CHAT_ID', ''),
        }
    ],
}

With every credential empty (a development machine) backups are off and the commands say "nothing to do". With some set and some missing, manage.py check names each one.

python manage.py check --deploy                                  # bucket lock, pg_dump version
python manage.py backup_offsite                                  # a pass now
python manage.py backup_offsite --without-media --reason deploy  # before a migration
python manage.py backup_check                                    # the morning check
python manage.py backup_list
python manage.py backup_restore --stamp latest --identity key.txt --into ./restore

The image needs pg_dump (at least the server's major), zstd and age. The bucket must be created with Object Lock and a default COMPLIANCE rule of LOCK_DAYS days.

Documentation

https://corneizer.github.io/django-offsite-backup/ — installation, every setting, S3 providers, retention and locks, restore drills, the security model, troubleshooting by check code, and a page for AI assistants wiring the package into a project.

License

MIT

Metadata

Release files for django-offsite-backup 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-offsite-backup 0.1.0
File Size Uploaded Provenance Actions
django_offsite_backup-0.1.0.tar.gz 119.4 kB With provenance Details for django_offsite_backup-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-offsite-backup 0.1.0
File Interpreter ABI Platform Actions
django_offsite_backup-0.1.0-py3-none-any.whl Python 3 none any Details for django_offsite_backup-0.1.0-py3-none-any.whl

Total release size: 191.7 kB

Release files / django_offsite_backup-0.1.0.tar.gz

Download URL django_offsite_backup-0.1.0.tar.gz
Size 119.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d7eb90f41f6c1f8c1bff13136b9c7078a70c064fd0ca5e5ae50a498aece7673f
BLAKE2b-256 checksum
How to use checksums
9851bbbfb8a6ae498b9fa0860f0573fa6ac9e3d146609e888ab64082ce75a427
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / django_offsite_backup-0.1.0-py3-none-any.whl

Download URL django_offsite_backup-0.1.0-py3-none-any.whl
Size 72.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ea00ae23e990e3ee7875eaa24f974d092a7b447116f28aec8adca8191f1f5c1
BLAKE2b-256 checksum
How to use checksums
63d4338b110477e8dd21493741eff180692ddb7fc18dadeb12921910e0fdeba9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for django-offsite-backup 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_offsite_backup-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page