5

I'm trying to move data from our QA servers to production (or dev->local, qa->dev, etc.) with the Django dumpdata and loaddata commands. I've successfully got things exported that have no foreign dependencies, like so:

python manage.py dumpdata --natural-foreign --indent=4 snippets.somemodel

When trying to migrate content-heavy models (with things like users, documents, images attached to them), I get lots of foreign key complaints. This is particularly problematic because users, documents, images are different across all the environments. I would love to be able to just move the content and ignore things that depend on foreign keys - is that possible?

Michael Volo
  • 314
  • 3
  • 13
  • Why don't you copy over the complete database? – allcaps May 03 '18 at 18:41
  • Because, the user authentication system - and images/documents are all external and different to each system. We're using oauth for users - and cloudfront/S3 for uploads. @allcaps – Michael Volo May 03 '18 at 20:25
  • I hacked wagtail-transfer https://github.com/wagtail/wagtail-transfer once to migrate content by forcing user constraints to adhere to a new user model. https://github.com/wagtail/wagtail-transfer/issues/126 - the next time I do it I may polish up the process - I'm sure I'm going to have to do it again in the future. Maybe this is helpful for you? – n8thanael Sep 15 '22 at 15:28

0 Answers0