There are a million records in our old CMS system. Now we want to migrate the old data to Wagtail. How to import these data? I know I have to create a model to store the data, but how to import the records to the model tables in Wagtail? Should I insert these records into the MySql database immediately? Or use some APIs or functions of wagtail?
Thanks very much.
I have taken the following approach several times when migrating complicated Drupal sites to Wagtail:
Export the legacy content in some format that I can easily manipulate with python. (The Drupal sites I worked with generated CSV exports, but you could just as easily work with JSON or XML; whatever you can get your old system to spit out.)
Write a Django management command that parses your export and creates Wagtail page objects. I found these instructions helpful, though at
step 4 I do page.save_revision().publish()
instead of just page.save()
.
You've got a lot more records than I ever dealt with, so perhaps you'd find it easier to skip step 1 and query your old db directly in the management command.
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