dj_backup is an installable module for Django that is used for backup purposes.
Project description
dj_backup
What is this ?
DJ Backup is a Django app that provides the capability to back up your files and databases.
supported databases
- mysql
- postgres
- sqlite
supported storages
- local
- sftp server
- ftp server
- dropbox(beta)
- telegram bot
How to use ?
- First you need to install dj_backup
pip install djbackup
2. After that, add the dj_backup and django_q apps to your Django project's installed apps.
INSTALLED_APPS = [
...
...
# apps
'dj_backup',
'django_q'
]
- add static files dir path to django
STATICFILES_DIRS = (
...
os.path.join(BASE_DIR, 'dj_backup/static/'),
)
- add locale file to django(
optional)
LOCALE_PATHS = (
...
BASE_DIR/ 'dj_backup/locale',
)
- add dj_backup urls to project urls
urlpatterns = [
...
path('dj-backup/', include('dj_backup.urls', namespace='dj_backup')),
...
]
6. set dj_backup config to django settings
DJ_BACKUP_CONFIG = {
# optional (if dj_backup cant find `pg_dump` file then you must fill this
'POSTGRESQL_DUMP_PATH': None,
# optional (if dj_backup cant find `mysqldump` file then you must fill this
'MYSQL_DUMP_PATH': None,
# if you want backup external databases you can set this config
# By default local databases are accessible and can be backed up
'EXTERNAL_DATABASES': {
# 'external_db': {
# 'ENGINE': 'mysql',
# 'NAME': 'test',
# 'USER': 'test',
# 'PASSWORD': 'test',
# 'HOST': '127.0.0.1', # Or an IP Address that your DB is hosted on
# 'PORT': 3306 # optional
# },
...
...
},
'BASE_ROOT_DIRS': [
# the main path for the files that need to be backed up
BASE_DIR,
...
],
'BACKUP_TEMP_DIR': BASE_DIR / 'backup/temp',
'STORAGES': {
'LOCAL': {
'OUT': BASE_DIR / 'backup/result' # the path local storage
},
'SFTP_SERVER': {
'HOST': 'xxx.xxx.xxx.xxx',
'USERNAME': 'xxx.xxx.xxx.xxx',
'PASSWORD': 'xxx.xxx.xxx.xxx',
'OUT': '/backups'
},
'FTP_SERVER': {
'HOST': "xxx.xxx.xxx.xxx",
'USERNAME': "xxx.xxx.xxx.xxx",
'PASSWORD': "xxx.xxx.xxx.xxx",
'OUT': '/backups'
},
'DROPBOX': {
'ACCESS_TOKEN': 'xxx.xxx.xxx.xxx',
'OUT': '/backups'
},
'TELEGRAM_BOT': {
'BOT_TOKEN': 'xxx',
'CHAT_ID': 'xxx'
}
}
}
7. migrate & collect static files
python manage.py migrate
python manage.py collectstatic
8. run backup!
python manage.py run-backup
9. Dashboard
now you can access to dj_backup dashboard
127.0.0.1:8000/dj-backup/
OR
xxx.xxx:xxxx/dj-backup/
NOTE:
If you dont need any of the storages, you must remove that configuration
because you get an error if it cant be connected
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
djbackup-2.0.3.tar.gz
(3.7 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djbackup-2.0.3.tar.gz.
File metadata
- Download URL: djbackup-2.0.3.tar.gz
- Upload date:
- Size: 3.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c6f3ea9939f74b712967cc8f880fb8fc57985d796aade893cccdbc27e2609a9
|
|
| MD5 |
fa5c71015513696ab63e687292b8d333
|
|
| BLAKE2b-256 |
b52b8ed8a2029b38529e046ad2ad217c121c0dbd8e397a397a119dcffbe200a8
|
File details
Details for the file djbackup-2.0.3-py3-none-any.whl.
File metadata
- Download URL: djbackup-2.0.3-py3-none-any.whl
- Upload date:
- Size: 3.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9df8908dd3ed0f0dbbd934e6a2d35cb3a8c7885043124b432a81dad7b444c54
|
|
| MD5 |
9b3e66e4698ff99c4b51a29eec8d7aec
|
|
| BLAKE2b-256 |
09aab12c2ca535c0488fd1e5a992a78ed35c8ef47384003725d6d98cb7edf71f
|