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
- Install with pip:
pip install django-database-backup-to-git
- Set up a Git repository outside of your application's main Git repository.
- Add
dbbackup_git
to yourINSTALLED_APPS
. - In you settings file, specify the
DBBACKUP_GIT
setting
DBBACKUP_GIT = {
'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`
- Run
manage.py help
, check thatdbbackup_git
is listed as available command.
Usage
Typing manage.py dbbackup_git
will also display output. When running it from cron, use manage.py dbbackup_git --silent
.
Running with cron
Create the following script dbbackup-git.sh
:
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SCRIPT_DIR/../src
source ../venv/bin/activate
./manage.py dbbackup_git
Add it to hourly cron
sudo ln -s `pwd`/dbbackup-git.sh /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.
Source Distribution
Built Distribution
File details
Details for the file django-database-backup-to-git-1.4.0.tar.gz
.
File metadata
- Download URL: django-database-backup-to-git-1.4.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62f185584bc5e2abc4f9bac88a1c0acf3d449def6b7bd6142acd9507d1002ae3 |
|
MD5 | cfcf1a0dfd912a035e8fb855cb867327 |
|
BLAKE2b-256 | 7aa992e33386a94eeef1836e1fd1294b0196ff8bf64cea3e4acb8b80a9e4d593 |
Provenance
File details
Details for the file django_database_backup_to_git-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: django_database_backup_to_git-1.4.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1c1893825d262f257a9edbb090a7c45bf89607b227ff72a8e4cf3ec79a38157 |
|
MD5 | e7982332497160be5274389355baee35 |
|
BLAKE2b-256 | e4a1b654778bd340935ad034a7a34e3e45c492cb09349c9e587a281f4dcfc8ff |