dj_backup
What is this ?
DJ Backup is a Django app that provides the capability to back up your files and databases.
Overview
DJ Backup is a powerful and flexible Django application designed to automate and manage backups for your project files and databases. With support for multiple storage providers and databases, it’s an essential tool for developers and system administrators looking to ensure data safety.
Links
Key Features
- Multiple Database Support: Backup MySQL, PostgreSQL, and SQLite databases effortlessly.
- Flexible Storage Options: Store backups locally or on remote services like SFTP, FTP, Dropbox, or Telegram Bot.
- Web Dashboard: Intuitive interface to manage and monitor backup tasks.
- Highly Configurable: Customize backup directories, storage locations, and logging levels.
- Lightweight & Modular: Install only the dependencies you need for your setup.
- Open Source: Licensed under MIT, with a welcoming community for contributions.
Supported Databases
- MySQL
- PostgreSQL
- SQLite
Supported Storage Providers
- Local
- SFTP Server
- FTP Server
- Dropbox
- Telegram Bot
Installation
Prerequisites
- Python 3.8 or higher
- Django 3.2 or higher
How to use?(Step-by-Step Guide)
-
Install DJ Backup
pip install djbackup
To include all optional features (databases and storages):
pip install djbackup[all]
-
Add
dj_backuptoINSTALLED_APPS# settings.py INSTALLED_APPS = [ # Other apps 'dj_backup', ]
-
Configure Static Files
# settings.py from dj_backup.core.utils.static import load_static STATICFILES_DIRS = [ # Other static directories load_static(), ]
-
Add DJ Backup URLs
# urls.py from django.urls import include, path urlpatterns = [ # Other URLs path('dj-backup/', include('dj_backup.urls', namespace='dj_backup')), ]
-
Set Up Basic Configuration
# settings.py DJ_BACKUP_CONFIG = { 'STORAGES': { 'LOCAL': { 'OUT': BASE_DIR / 'backup/result' }, } }
-
Run Migrate and Collect Static Files
# cmd python manage.py migrate python manage.py collectstatic
-
Execute Backup
# cmd python manage.py run-backup
-
Start the Django Server
# cmd python manage.py runserver
Note: For production, use a WSGI/ASGI server like Gunicorn or uWSGI instead of
runserver.
Access the Dashboard
Navigate to:
http://127.0.0.1:8000/dj-backup/
Or your custom domain:
http://your-domain:port/dj-backup/
Advanced Configuration
A complete example of DJ_BACKUP_CONFIG:
# settings.py
DJ_BACKUP_CONFIG = {
'MAX_WORKERS': 5, # Maximum concurrent backup tasks
'NOTIFICATION_OBJECT_LOG_LEVEL': 'WARNING', # Log level: DEBUG, INFO, WARNING, ERROR, CRITICAL
'POSTGRESQL_DUMP_PATH': None, # Path to PostgreSQL dump executable (if needed)
'MYSQL_DUMP_PATH': None, # Path to MySQL dump executable (if needed)
# External databases(Optional)
'EXTERNAL_DATABASES': {
'default2': {
'ENGINE': 'postgresql',
'NAME': 'test_db',
'USER': 'postgres',
'PASSWORD': 'your_password',
'HOST': '127.0.0.1',
},
'default3': {
'ENGINE': 'mysql',
'NAME': 'test_db',
'USER': 'root',
'PASSWORD': 'your_password',
'HOST': '127.0.0.1',
},
},
'BASE_ROOT_DIRS': [BASE_DIR], # Directories to include in backups
'BACKUP_TEMP_DIR': BASE_DIR / 'backup/temp', # Temporary backup storage
'BACKUP_SYS_DIR': BASE_DIR / 'backup/sys', # System backup storage
'STORAGES': {
'LOCAL': {
'OUT': BASE_DIR / 'backup/result'
},
'TELEGRAM_BOT': {
'BOT_TOKEN': 'your_bot_token',
'CHAT_ID': 'your_chat_id'
},
'SFTP_SERVER': {
'HOST': 'sftp.example.com',
'USERNAME': 'your_username',
'PASSWORD': 'your_password',
'OUT': 'backups'
},
'FTP_SERVER': {
'HOST': 'ftp.example.com',
'USERNAME': 'your_username',
'PASSWORD': 'your_password',
'OUT': 'backups'
},
'DROPBOX': {
'APP_KEY': 'your_app_key',
'OUT': '/dj_backup/'
}
}
}
Additional Dependencies
Install specific dependencies for your needs:
Storage Providers
| Provider | Install Command |
|---|---|
| Telegram Bot | pip install djbackup[telegram] |
| SFTP Server | pip install djbackup[sftpserver] |
| FTP Server | pip install djbackup[ftpserver] |
| Dropbox | pip install djbackup[dropbox] |
Databases
| Database | Install Command |
|---|---|
| MySQL | pip install djbackup[mysql] |
| PostgreSQL | pip install djbackup[postgresql] |
Notes
- Remove unused storage configurations to prevent connection errors.
- Specify
POSTGRESQL_DUMP_PATHorMYSQL_DUMP_PATHif the default dump executables are not found. - Regularly update dependencies and check the documentation for new features.
- For secure backups, consider encrypting sensitive data before uploading to remote storage.
Contributing
We welcome contributions! Please read our Contributing Guidelines for details on how to submit pull requests, report bugs, or suggest features.
License
DJ Backup is licensed under the MIT License.
Contact
For bugs, feature requests, or questions, please open an issue on GitHub Issues.
⭐ Star this project on GitHub to support its development! ⭐
Metadata
Release files for djbackup 2.3.2
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 |
|---|---|---|---|---|
| djbackup-2.3.2.tar.gz | 1.7 MB | Without provenance | Details for djbackup-2.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| djbackup-2.3.2-py3-none-any.whl | Python 3 | none | any | Details for djbackup-2.3.2-py3-none-any.whl |
Total release size: 3.5 MB
Release files / djbackup-2.3.2.tar.gz
| Download URL | djbackup-2.3.2.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1efdadb803de5302a0b8f5770c832396d6fce7f1c6c9e0c8946f1de775e78fec
|
|
BLAKE2b-256 checksum How to use checksums |
bb2994e92d649fd6f4f0a6f6d29b4ae52d73842dd4ac5ab73b32320b7ff4154e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.5
|
Release files / djbackup-2.3.2-py3-none-any.whl
| Download URL | djbackup-2.3.2-py3-none-any.whl |
|---|---|
| Size | 1.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c60ab9867ce803d17cb025266f1fe7744b22d8c3c774fa3bef26d8811592c50
|
|
BLAKE2b-256 checksum How to use checksums |
2999bf4d5aa99239a2d73535d019ec67c889e04dfb4f22bcb6a0f880b019a6f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.5
|
Security for djbackup 2.3.2
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.