Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to completely dump the data for Django-CMS

Tags:

I have an instance of Django-CMS already running in a production environment. I would like to dump all the data related to the CMS (PAGES and PLUGINS) so that I may load it back into my development environment.

When I do python manage.py dumpdata cms it dumps most of the data, but not all of it. None of the content for the plugins is dumped. When I look at the django-cms source, I see that the plugins are organized in a different folder than the rest of the models - I'm sure this has something to do with the behavior of dumpdata.

Does anyone know how they would achieve what I am trying to do?

Thanks for your help/answers!

like image 414
edub Avatar asked Feb 24 '10 03:02

edub


People also ask

How do I dump a database in django?

The manage.py dumpdata command dumps the data from your database either in the command line or in a file that you specify. You do not want to it to dump everything, however, because it will make it difficult to load the data into another database. It created the file with the dumped data.

Is django good for CMS?

django CMS is user friendly and has a very intuitive drag and drop interface. It's built around the needs of multi-lingual publishing by default, not as an afterthought: all websites, pages and content can exist in multiple language versions.

Is django CMS free?

django CMS is a free and open source content management system platform for publishing content on the World Wide Web and intranets.

Is django a framework or CMS?

Django is a web framework which can sometimes be used to make a CMS, but it is not, by itself, a full CMS.


2 Answers

Django's built in dump and restore commands work well for migrating the contents of the CMS.

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 (you just need the app name, not the full path, like cms.plugins.text).

like image 156
Michael C. O'Connor Avatar answered Sep 22 '22 07:09

Michael C. O'Connor


Here's an update to the procedure I use:

./manage.py dumpdata >fixtures/all.json

psql
DROP DATABASE [DBNAME];
createdb -T template_postgis [DBNAME]

./manage.py syncdb

psql [DBNAME]

delete from auth_group_permissions; delete from auth_permission; delete from django_admin_log; delete from django_content_type;

If you don't delete the tables above you'll get this error when loading the fixtures:

IntegrityError: duplicate key value violates unique constraint django_content_type_app_label_key

And then:

./manage.py loaddata fixtures/all.json

Philipp

like image 35
Googol Avatar answered Sep 19 '22 07:09

Googol