Skip to main content

Django specific database backup system

Project description

Django Database Backup to Git

A Django app, which makes a database backup in JSON format, commits and pushes it to a dedicated Git repository. Intended to be run in deployment scripts and as a scheduled task.

Installation and Setup

  1. Install with pip:
pip install django-database-backup-to-git
  1. Set up a Git repository outside of your application's main Git repository.
  2. Add dbbackup_git to your INSTALLED_APPS.
  3. In you settings file, specify the DBBACKUP_GIT setting
    'DATABASE_BACKUP_FILENAME': os.path.join(BASE_DIR, '..', '..', 'myapp-db-backup', 'db.json'),
    'PUSH': True  # Determines whether the created backup is pushed to a remote repository, defaults to `True`
  1. Run help, check that dbbackup_git is listed as available command.


Typing dbbackup_git will also display output. When running it from cron, use dbbackup_git --silent.

Running with cron

Create the following script


set -e

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SCRIPT_DIR/../src

source ../venv/bin/activate

./ dbbackup_git

Add it to hourly cron

sudo ln -s `pwd`/ /etc/cron.hourly/dbbackup-git

Test it

run-parts --test /etc/cron.hourly

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-database-backup-to-git, version 1.4.0
Filename, size File type Python version Upload date Hashes
Filename, size django_database_backup_to_git-1.4.0-py3-none-any.whl (7.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-database-backup-to-git-1.4.0.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page