Skip to content
Joe Blankenship edited this page May 21, 2017 · 1 revision

Backing-up Data

There are a two initial ways to backup your data: interacting with the Django app and interacting with the MySQL database.

Back-up via Django app

  1. Before attempting this, ensure your MySQL database is running and you are working in your virtual environment.
  2. 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.

Loading your Back-up via Django app

  1. 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.
  2. 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.
  3. 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
  4. If there were no error messages, verify your data is there by starting the application and logging-in.

Back-up via MySQL

  1. Before attempting this, ensure your MySQL database is running. You will also need the credentials for MySQL.
  2. In the terminal, type: mysqldump --opt -u your_username -p the_database_name > your_backup_file.sql
  3. Enter the password when prompted and if no errors occurred, you should now have your_back_file.sql with all of the data from the_database_name.

Loading your Back-up via MySQL

  1. This step assumes you have either deleted the MySQL database for a project or created a new one.
  2. Verify an appropriately named database has been created in MySQL (e.g., libreqda). Refer to the installation instructions for details.
  3. In the terminal, type: mysql -u your_username -p the_database_name < your_backup_file.sql
  4. Enter the password when prompted and if no errors occurred, you should now have the_database_name with all of the data from your_backup_file.