forked from tryolabs/libreQDA
-
Notifications
You must be signed in to change notification settings - Fork 7
Backing up Data
Joe Blankenship edited this page May 21, 2017
·
1 revision
There are a two initial ways to backup your data: interacting with the Django app and interacting with the MySQL database.
- Before attempting this, ensure your MySQL database is running and you are working in your virtual environment.
- Navigate to where the
manage.py
file is located and type:python manage.py dumpdata -a libreqda > libreqda_datadump.json
. This will output the contents of your projects into a JSON file.
- This step assumes you have either deleted the MySQL database for a project or you have created a new database into which the back-up will be placed.
- If you have just rebuilt the entire libreqda virtual environment, the JSON back-up file will be put into the database you identified in the
local_settings.py
file. - When all requirements for loading the data have been met (i.e., MySQL database is running, virtualenv is active), run this command:
python manage.py loaddata libreqda_datadump.json
- If there were no error messages, verify your data is there by starting the application and logging-in.
- Before attempting this, ensure your MySQL database is running. You will also need the credentials for MySQL.
- In the terminal, type:
mysqldump --opt -u your_username -p the_database_name > your_backup_file.sql
- Enter the password when prompted and if no errors occurred, you should now have
your_back_file.sql
with all of the data fromthe_database_name
.
- This step assumes you have either deleted the MySQL database for a project or created a new one.
- Verify an appropriately named database has been created in MySQL (e.g.,
libreqda
). Refer to the installation instructions for details. - In the terminal, type:
mysql -u your_username -p the_database_name < your_backup_file.sql
- Enter the password when prompted and if no errors occurred, you should now have
the_database_name
with all of the data fromyour_backup_file
.