Django : Transfer data from Sqlite to another database
Whenever a person starts learning Django, she/he starts from Sqlite database. And by the time you know most of the Django, you realize that that your most important data is in the Sqlite and now you would want to use high end databases like PostgreSQL or MySQL.
In order to achieve that, do the following steps in order :
python manage.py dumpdata > db.json
- Change the database settings to new database such as of MySQL / PostgreSQL.
python manage.py migrate
python manage.py shell
Enter the following in the shell
from django.contrib.contenttypes.models import ContentType
python manage.py loaddata db.json
Thats it .. and now your new database should have all the data from the Sqlite. Cheers !