When we begin our learning journey with Django we use the default database i.e., sqlite. It is very much enough for development and learning purposes. But as we make progress with our project and/or want to switch to a high end databases like MySQL,PostgreSQL etc. we will have to transfer our existing data to the new database.
python manage.py dumpdata -o data.json --format json
Change the settings.py file and connect to another database. After that
python manage.py migrate
This would create the tables according to the models we have made in the new database.
python manage.py loaddata data.json
If run successfully. All the data will be transferred to the new database.
You must be logged in to post a comment.