Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate data from other CMS to Wagtail?

Tags:

wagtail

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.

like image 811
beibeitu Avatar asked Oct 17 '25 16:10

beibeitu


1 Answers

I have taken the following approach several times when migrating complicated Drupal sites to Wagtail:

  1. 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.)

  2. 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.

like image 138
matthewn Avatar answered Oct 22 '25 03:10

matthewn