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_gitto yourINSTALLED_APPS. - In you settings file, specify the
DBBACKUP_GITsetting
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_gitis 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
python 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
Cron within a Docker container
If your project is living inside a Docker container the "Using Cron Within Your Containers" section of this article might be useful for you.
Metadata
Release files for django-database-backup-to-git 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-database-backup-to-git-2.0.tar.gz | 4.3 kB | Without provenance | Details for django-database-backup-to-git-2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_database_backup_to_git-2.0-py3-none-any.whl | Python 3 | none | any | Details for django_database_backup_to_git-2.0-py3-none-any.whl |
Total release size: 9.9 kB
Release files / django-database-backup-to-git-2.0.tar.gz
| Download URL | django-database-backup-to-git-2.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfacfd3857e1cfee1673040f36d2cf36d30f1002514c36bf67b4ff31fff0670c
|
|
BLAKE2b-256 checksum How to use checksums |
e65866a09dd94784910b1f0fc4c1558e6c202b6763c1e73873f85bf9ec0b2f4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.0
|
Release files / django_database_backup_to_git-2.0-py3-none-any.whl
| Download URL | django_database_backup_to_git-2.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54db8149ce13a5180cb932c03961f11d2ea0909fa1d3e7c693d9bec86f61ef65
|
|
BLAKE2b-256 checksum How to use checksums |
3fdbf32f28b70f3df5de9230f69738d2ccc76b1f96397662009bc6b5d5278a57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.0
|
Security for django-database-backup-to-git 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.
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.