Skip to main content

django-backupgram

A Django admin control panel for the backupgram REST API.

What it is

django-backupgram is a thin Django admin client. It talks to one or more backupgram containers over their REST API, letting you:

  • Trigger backups on demand
  • Browse and download backup files
  • Delete old backups
  • Restore a backup to a target database
  • Watch async jobs (restore, backup) as they run
  • Edit runtime config of the backup container

It does not perform backups itself — the backup logic lives entirely inside the containers. django-backupgram is only the admin UI that drives them.

Requirements

  • Python 3.11 – 3.13
  • Django 5.2+
  • One or more backup containers reachable from the Django server with REST_API_ENABLE=TRUE and a REST_API_TOKEN set

See the backup container's REST API docs for how to enable the API.

Install

pip install django-backupgram

Setup

  1. Add "backupgram" to INSTALLED_APPS:

    INSTALLED_APPS = [
        ...
        "backupgram",
    ]
    
  2. Run migrations:

    python manage.py migrate
    
  3. Open Django admin → Backup servers → Add, and fill in:

    • Name — a friendly label (e.g. production)
    • Base URL — the backup container's REST API endpoint, e.g. https://backup:8081. Docker service names are allowed (the request is made server-side).
    • Token — the bearer token configured via REST_API_TOKEN on the container (see below).

The API token

The token is the backup container's single admin bearer key — you generate it yourself and set it on the container, then paste the same value into the Token field here.

Generate a high-entropy value (≥ 32 bytes of randomness):

openssl rand -base64 48
# or
python3 -c "import secrets; print(secrets.token_urlsafe(48))"

Set it on the backup container via REST_API_TOKEN (or, recommended, REST_API_TOKEN_FILE pointing at a Docker secret), then enter the same token in admin. The container compares it in constant time and refuses to start if the API is enabled without one; here it is stored encrypted at rest and sent only server-side. To rotate: change it on the container, recreate it, and update the Token field. See the REST API auth docs.

Usage

From the Backup servers changelist, each server row shows a reachability badge and links to its dashboard. The dashboard provides:

Action Notes
Run backup Triggers an immediate backup
Backups Lists all backup files; download or delete individual files
Restore Select a file, enter the target database name, confirm
Jobs Live view of async jobs (backup/restore in progress)
Config View and edit the container's runtime configuration

Long-running operations (restore, triggered backup) run as async jobs inside the backup container. Refresh the Jobs page to see progress and final status.

Security

  • The bearer token is stored encrypted at rest using Fernet symmetric encryption. The key is derived from Django's SECRET_KEY.
  • The token is write-only in the admin interface — it is never rendered back into any form or page.
  • Rotating SECRET_KEY invalidates all stored tokens. After a key rotation, re-enter each server's token in the admin.
  • All REST calls are made server-side — the token never reaches the browser.
  • Put the backup container's REST API behind TLS and a reverse proxy. Do not expose it directly on a public network.

Optional settings

Add to your Django settings to override defaults:

# Timeout (seconds) for the reachability check shown in the changelist badge.
# Default: 3
BACKUPGRAM_REACHABILITY_TIMEOUT = 3

Development

uv sync
uv run pytest

Links

Metadata

Release files for django-backupgram 0.1.1

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-backupgram 0.1.1
File Size Uploaded Provenance Actions
django_backupgram-0.1.1.tar.gz 74.3 kB Without provenance Details for django_backupgram-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-backupgram 0.1.1
File Interpreter ABI Platform Actions
django_backupgram-0.1.1-py3-none-any.whl Python 3 none any Details for django_backupgram-0.1.1-py3-none-any.whl

Total release size: 113.2 kB

Release files / django_backupgram-0.1.1.tar.gz

Download URL django_backupgram-0.1.1.tar.gz
Size 74.3 kB
Tags Source
SHA-256 checksum
How to use checksums
be29bae7a0951aa25fb50905a97d526cae4515001b5bf9820f101b904e400a5d
BLAKE2b-256 checksum
How to use checksums
977fe0812fa1c3b502e544f64f843f0207e523378b22f747ee246c60117e7904
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release files / django_backupgram-0.1.1-py3-none-any.whl

Download URL django_backupgram-0.1.1-py3-none-any.whl
Size 38.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e04d23b60fdcd9acd3f1af5b3c2b5e5d4080ff0d6ebebb2c95b5d6c1d2e73498
BLAKE2b-256 checksum
How to use checksums
d2b670d9e60f6232973ba2819dd28d3060d6997e21a83b68d5293bbd6f64d2d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Security for django-backupgram 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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