skip to content
Notes && Anecdotes
A decorative, semi-related stock photo that adds less value than this comment.

Export data from one Django to another


Sometimes I clone a repository with Django and make a setup of the environment on my own machine. Then I would usually like to have some testdata populated in my environment. So here’s how to copy the data from one Django installation (production) to my environment (test). 1. ssh to the remote server

ssh username@hostname
  1. Navigate to the folder
cd /path/to/remote/django
  1. Extract data to db.json
python dumpdata db.json
  1. Open a local terminal and copy down the file
 scp username@hostname:/path/to/remote/django/db.json /path/to/local/django/db.json
  1. Navigate to the folder locally
 cd /path/to/local/django/
  1. Import the data from the file
python loaddata db.json

Source: this guide