Answer the question
In order to leave comments, you need to log in
How to neatly move some records from one db to another in Django?
There are two servers (test and prod), on the test there is some data that needs to be moved to prod. This is a chain of related data (user, profile, cart, model A, model B), so it is desirable to extract everything together and load it back together.
A small nuance: PK must also be placed somehow without conflict.
Any ideas how it's done? Thank you in advance
Answer the question
In order to leave comments, you need to log in
It is necessary to slightly correct the models or rather add managers to the models. Add relationship serialization rule get_by_natural_key() https://docs.djangoproject.com/en/2.0/topics/seria... . Then dumpdata on test and loaddata on production.
For such dances, it is better to make a separate branch to transfer data, and then delete it and forget it like a bad dream.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question