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!
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.
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.
django CMS is a free and open source content management system platform for publishing content on the World Wide Web and intranets.
Django is a web framework which can sometimes be used to make a CMS, but it is not, by itself, a full CMS.
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
).
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
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