| 1 |
--- |
| 2 |
hide: |
| 3 |
- navigation |
| 4 |
--- |
| 5 |
|
| 6 |
## Step 1: Install from PyPI |
| 7 |
|
| 8 |
You can install the latest stable release from PyPI with pip. |
| 9 |
|
| 10 |
```bash |
| 11 |
pip install django-dbbackup |
| 12 |
``` |
| 13 |
|
| 14 |
??? tip "Alternative: Install the latest from GitHub" |
| 15 |
|
| 16 |
In general, you should not be downloading and installing stuff |
| 17 |
directly from repositories. Security is important; bypassing PyPI repositories is a bad habit. |
| 18 |
|
| 19 |
However, if you are willing to accept the risks of installing directly from GitHub, you can do so with pip: |
| 20 |
|
| 21 |
```bash |
| 22 |
pip install -e git+https://github.com/Archmonger/django-dbbackup.git#egg=django-dbbackup |
| 23 |
``` |
| 24 |
|
| 25 |
## Step 2: Configure `settings.py` |
| 26 |
|
| 27 |
In your `settings.py`, make sure you have `dbbackup` in your `INSTALLED_APPS` have configured a storage backend. |
| 28 |
|
| 29 |
```python |
| 30 |
INSTALLED_APPS = ( |
| 31 |
... , |
| 32 |
'dbbackup', |
| 33 |
) |
| 34 |
``` |
| 35 |
|
| 36 |
## Step 3: Choose a storage backend |
| 37 |
|
| 38 |
You need to configure at least one storage backend for database/media backups. This is done by adding a `dbbackup` entry to the `STORAGES` setting in your `settings.py`. |
| 39 |
|
| 40 |
```python |
| 41 |
STORAGES = { |
| 42 |
..., |
| 43 |
'dbbackup': { |
| 44 |
'BACKEND': 'django.core.files.storage.FileSystemStorage', |
| 45 |
'OPTIONS': { |
| 46 |
'location': '/my/backup/dir/', |
| 47 |
}, |
| 48 |
}, |
| 49 |
} |
| 50 |
``` |
| 51 |
|
| 52 |
??? tip "Alternative: Use a different storage system" |
| 53 |
|
| 54 |
This example uses filesystem storage, but there are several other options available. See [Storage settings](storage.md) for more information. |
| 55 |
|
| 56 |
## Step 4: Create your first backup |
| 57 |
|
| 58 |
Now, you should be able to create your first backup by running the Django management command. |
| 59 |
|
| 60 |
```bash |
| 61 |
python manage.py dbbackup |
| 62 |
``` |
| 63 |
|
| 64 |
You should now see a new file in your backup directory. |