I have developed a simple django application using sqlite3. At first, I wanted to keep it simple using sqlite3 but, things are beginning to scale up (Yes, I actually started using that application with sqlite3! Shame on me...) so I want to migrate all my data to postgresql database.
Does django or another third-party provide such feature, or should I suffer for my own stupidity...
Django's admin doesn't have any explicit support for multiple databases. If you want to provide an admin interface for a model on a database other than that specified by your router chain, you'll need to write custom ModelAdmin classes that will direct the admin to use a specific database for content.
First, execute
manage.py dumpdata > out.json
then change your DB config, migrate (or syncdb) and finally
echo "delete from auth_permission; delete from django_content_type;" | python manage.py dbshell
(If you have Django older than 1.11, you need to use
echo "delete from django_content_type;" | manage.py dbshell
)
Then load the JSON file:
manage.py loaddata out.json
(as of 2013 django_contenttype
is replaced with django_content_type
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With