DBBackup to Dropbox¶
In order to backup to Dropbox, you'll first need to create a Dropbox Account and set it up to communicate with the Django-DBBackup application. Don't worry, all instructions are below.
Setup Your Dropbox Account¶
- Login to Dropbox and navigate to Developers » MyApps.
- Click the button to create a new app and name it whatever you like. For reference, I named mine 'Website Backups'.
- After your app is created, note the options button and more importantly the 'App Key' and 'App Secret' values inside. You'll need those later.
Setup Your Django Project¶
- Install django-dbbackup and the required Python
Dropbox Client API.
If using Pip, you can install this package using the following command:
>> cd django-dbbackup >> python setup.py install >> pip install hg+https://bitbucket.org/dropboxapi/dropbox-client-python
- Add 'dbbackup' to INSTALLED_APPS in your settings.py file.
- Include the required settings below.
DBBACKUP_STORAGE = 'dbbackup.storage.dropbox_storage' DBBACKUP_TOKENS_FILEPATH = '<local_tokens_filepath>' DBBACKUP_DROPBOX_APP_KEY = '<dropbox_app_key>' DBBACKUP_DROPBOX_APP_SECRET = '<dropbox_app_secret>'
- Now you're ready to use the backup management commands. The first time you run a command you'll be prompted to visit a Dropbox URL to allow DBBackup access to your Dropbox account.
Available Settings¶
DBBACKUP_TOKENS_FILEPATH (required)¶
The local filepath to store the Dropbox oAuth request and tokens. This file will be auto-created, but should be treated like any other password to access your website. NOTE: Do not share these keys with anyone you do not trust with access to your Dropbox files.
DBBACKUP_DROPBOX_APP_KEY (required)¶
String containing your Dropbox App Key. NOTE: Do not share these keys with anyone you do not trust with access to your Dropbox files.
DBBACKUP_DROPBOX_APP_SECRET (required)¶
String containing your Dropbox App Secret. NOTE: Do not share these keys with anyone you do not trust with access to your Dropbox files.
DBBACKUP_DROPBOX_ACCESS_TYPE (optional)¶
String containing your Dropbox Access Type. This is either 'dropbox' or 'app_folder' depending on the access type specified when creating your application on the Dropbox website. This defaults to 'dropbox', assuming your application has full access to your Dropbox folder.
DBBACKUP_DROPBOX_DIRECTORY (optional)¶
The directory in Dropbox you wish to save your backups. By default this is set to '/django-dbbackups/'.