4

I have a similar problem to solve. My database changes frequently on production environment, so I want to prepare my cms contents locally and migrate it with the production database. How can I do that?

There should be a handy way for tasks like this in django-cms.

Community
  • 1
  • 1
m8wxqq
  • 41
  • 2
  • Thanks for moving this. You wouldn't believe how many non-answers get posted every day. –  Jan 26 '11 at 14:01
  • Are you looking for version control like mercurial? – Matt Bannert Jan 28 '11 at 12:57
  • possible duplicate of [How to completely dump the data for Django-CMS](http://stackoverflow.com/questions/2323515/how-to-completely-dump-the-data-for-django-cms) – Louis May 01 '15 at 14:40

1 Answers1

6

It's pretty straightforward to dump and restore the contents of the CMS using Django's built in manage.py commands, so I think you could get a long way towards your goal with just that.

To dump the contents of the CMS, you need to include both the cms app as well as each of the plugin types you are using in the dumpdata command, so something like:

manage.py dumpdata cms text picture link file [other plugin types] > cms_export.json

to dump your content and

manage.py loaddata cms_export 

to restore it. You'll also have to zip up and move any media files you've uploaded as well, of course.

If this is going to be something that you do repeatedly, you might want to look into fabric -- that'll let you automate the content migration across an ssh channel.

Michael C. O'Connor
  • 9,742
  • 3
  • 37
  • 49