Skip to main content

Django admin control panel for the backupgram REST API (PostgreSQL backups over HTTP).

Project description

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 serversAdd, 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

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_backupgram-0.1.1.tar.gz (74.3 kB view details)

Uploaded Source

Built Distribution

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

django_backupgram-0.1.1-py3-none-any.whl (38.8 kB view details)

Uploaded Python 3

File details

Details for the file django_backupgram-0.1.1.tar.gz.

File metadata

  • Download URL: django_backupgram-0.1.1.tar.gz
  • Upload date:
  • Size: 74.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for django_backupgram-0.1.1.tar.gz
Algorithm Hash digest
SHA256 be29bae7a0951aa25fb50905a97d526cae4515001b5bf9820f101b904e400a5d
MD5 59830ced3a9eec4a0cd2a6dca9404e00
BLAKE2b-256 977fe0812fa1c3b502e544f64f843f0207e523378b22f747ee246c60117e7904

See more details on using hashes here.

File details

Details for the file django_backupgram-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_backupgram-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e04d23b60fdcd9acd3f1af5b3c2b5e5d4080ff0d6ebebb2c95b5d6c1d2e73498
MD5 fdbbd856f8ab5ae87cca189fc7665bf2
BLAKE2b-256 d2b670d9e60f6232973ba2819dd28d3060d6997e21a83b68d5293bbd6f64d2d4

See more details on using hashes here.

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