@@ -26,6 +26,7 @@ It is made to:
2626- Deal easily with remote archiving
2727- Keep your development database up to date
2828- Use Crontab or Celery to setup automated backups
29+ - Manually backup and restore via Django management commands
2930
3031Docs
3132====
@@ -42,160 +43,6 @@ restore mechanisms, apply compression and/or encryption and use the storage syst
4243It gives a simple interface to backup and restore your database or media
4344files.
4445
45- Management Commands
46- ===================
47-
48- dbbackup
49- --------
50-
51- Backup your database to the specified storage. By default this will backup all
52- databases specified in your settings.py file and will not delete any old
53- backups. You can optionally specify a server name to be included in the backup
54- filename.
55-
56- ::
57-
58- Usage: ./manage.py dbbackup [options]
59-
60- Options:
61- --noinput Tells Django to NOT prompt the user for input of any
62- kind.
63- -q, --quiet Tells Django to NOT output other text than errors.
64- -c, --clean Clean up old backup files
65- -d DATABASE, --database=DATABASE
66- Database to backup (default: everything)
67- -s SERVERNAME, --servername=SERVERNAME
68- Specify server name to include in backup filename
69- -z, --compress Compress the backup files
70- -e, --encrypt Encrypt the backup files
71- -o OUTPUT_FILENAME, --output-filename=OUTPUT_FILENAME
72- Specify filename on storage
73- -O OUTPUT_PATH, --output-path=OUTPUT_PATH
74- Specify where to store on local filesystem
75- -x EXCLUDE_TABLES, --exclude-tables=EXCLUDE_TABLES
76- Exclude tables data from backup (-x 'public.table1, public.table2')
77-
78- dbrestore
79- ---------
80-
81- Restore your database from the specified storage. By default this will lookup
82- the latest backup and restore from that. You may optionally specify a
83- servername if you you want to backup a database image that was created from a
84- different server. You may also specify an explicit local file to backup from.
85-
86- ::
87-
88- Usage: ./manage.py dbrestore [options]
89-
90- Options:
91- --noinput Tells Django to NOT prompt the user for input of any
92- kind.
93- -d DATABASE, --database=DATABASE
94- Database to restore
95- -i INPUT_FILENAME, --input-filename=INPUT_FILENAME
96- Specify filename to backup from
97- -I INPUT_PATH, --input-path=INPUT_PATH
98- Specify path on local filesystem to backup from
99- -s SERVERNAME, --servername=SERVERNAME
100- Use a different servername backup
101- -c, --decrypt Decrypt data before restoring
102- -p PASSPHRASE, --passphrase=PASSPHRASE
103- Passphrase for decrypt file
104- -z, --uncompress Uncompress gzip data before restoring
105- -n SCHEMA, --schema SCHEMA
106- Specify schema(s) to restore. Can be used multiple times.
107- -r, --no-drop Don't clean (drop) the database. This only works with mongodb and postgresql.
108- --pg-options PG_OPTIONS
109- Additional pg_restore options, e.g. '--if-exists --no-owner'. Use quotes.
110-
111- mediabackup
112- -----------
113-
114- Backup media files by get them one by one, include in a TAR file. ::
115-
116- Usage: ./manage.py mediabackup [options]
117-
118- Options:
119- --noinput Tells Django to NOT prompt the user for input of any
120- kind.
121- -q, --quiet Tells Django to NOT output other text than errors.
122- -c, --clean Clean up old backup files
123- -s SERVERNAME, --servername=SERVERNAME
124- Specify server name to include in backup filename
125- -z, --compress Compress the archive
126- -e, --encrypt Encrypt the backup files
127- -o OUTPUT_FILENAME, --output-filename=OUTPUT_FILENAME
128- Specify filename on storage
129- -O OUTPUT_PATH, --output-path=OUTPUT_PATH
130- Specify where to store on local filesystem
131-
132- mediarestore
133- ------------
134-
135- Restore media files from storage backup to your media storage. ::
136-
137- Usage: ./manage.py mediarestore [options]
138-
139- Options:
140- --noinput Tells Django to NOT prompt the user for input of any
141- kind.
142- -q, --quiet Tells Django to NOT output other text than errors.
143- -i INPUT_FILENAME, --input-filename=INPUT_FILENAME
144- Specify filename to backup from
145- -I INPUT_PATH, --input-path=INPUT_PATH
146- Specify path on local filesystem to backup from
147- -e, --decrypt Decrypt data before restoring
148- -p PASSPHRASE, --passphrase=PASSPHRASE
149- Passphrase for decrypt file
150- -z, --uncompress Uncompress gzip data before restoring
151- -r, --replace Replace existing files
152-
153- Tests
154- =====
155-
156- Tests are stored in `dbbackup.tests ` and to run them you must launch:
157-
158- ::
159-
160- python runtests.py
161-
162- In fact, ``runtests.py `` acts as a ``manage.py `` file and all Django commands
163- are available. So you could launch:
164-
165- ::
166-
167- python runtests.py shell
168-
169- to get a Python shell configured with the test project. Also all test
170- command options are available and usable to run only a selection of tests.
171- See `Django test command documentation `_ for more information about it.
172-
173- .. _`Django test command documentation` : https://docs.djangoproject.com/en/stable/topics/testing/overview/#running-tests
174-
175- There are even functional tests: ::
176-
177- ./functional.sh
178-
179- See documentation for details.
180-
181- To run the tests across all supported versions of Django and Python, you
182- can use Tox. Firstly install Tox:
183-
184- ::
185-
186- pip install tox
187-
188- To run the tests just use the command ``tox `` in the command line. If you
189- want to run the tests against just one specific test environment you can run
190- ``tox -e <testenv> ``. For example, to run the tests with Python3.9 and
191- Django3.2 you would run:
192-
193- ::
194-
195- tox -e py39-django32
196-
197- The available test environments can be found in ``tox.ini ``.
198-
19946Contributing
20047============
20148
0 commit comments