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.2.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.2.0
File Size Uploaded Provenance Actions
django_offsite_backup-0.2.0.tar.gz 143.8 kB With provenance Details for django_offsite_backup-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 221.7 kB

Release files / django_offsite_backup-0.2.0.tar.gz

Download URL django_offsite_backup-0.2.0.tar.gz
Size 143.8 kB
Tags Source
SHA-256 checksum
How to use checksums
48eee19115cfba34cab05f1f6cfd432cead5a6efd7c693ca632023072ebb6d1c
BLAKE2b-256 checksum
How to use checksums
ad51d2f9c6629dda5bd4e7bd59362456d63c3d25504d62f08afa9c131080bc62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.2.0-py3-none-any.whl

Download URL django_offsite_backup-0.2.0-py3-none-any.whl
Size 77.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a3ce7325a2dc3a7c787a98ee20cefc800d6b2898fa2241cbc0427580fe4e739
BLAKE2b-256 checksum
How to use checksums
f68864a70d6b0f4c677fa33ddd997d6903bb82e7326a4b8fc8767594a90c2b2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.2.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.2.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