python - How can I copy CMS pages from a development site to a live site? -


i've been integrating django cms django project has been in production on year. part of development activities, i've converted cms pages pages used static content before added django cms. development database contains pages copy live site rather require project staff recreate these pages on live site.

i have searched django cms documentation did not find command this. i've searched issues on github, questions on , django cms google groups. thing i've found this discussion 3 years ago. discussion mentions using dumpdata dump cms models. i've tried it. dump contains information about pages (for instance, created page , when) not contain contents of pages.

the live site has data must preserved. cannot perform database level dump on development site , restore on live site, erase or overwrite data exists on live site.

i'm using django 1.7 , django cms 3.1.0.

the discussion refer predates 3.x series. perhaps doing dumpdata models associated cms application was way go 3 years ago, but, discovered, not work now.

i recommend trying following steps on mirror of live site first surprises can taken care of ahead of real operation. if run trouble on mirror, can take time figuring problem. once ready modify live site, before anything, should backup database. better safe sorry. also, codebase on site should updated reflect development version before try moving data around.

you can use these steps:

  1. inspect installed_apps setting , make list of apps cms plugins , of applications these plugins depend on. may need consult installation instructions of of plugins recall depends on what.

    once have list can issue dumpdata command on development site cms , applications identified. site, have do:

    python manage.py dumpdata --natural-foreign cms filer \   cmsplugin_filer_file cmsplugin_filer_folder cmsplugin_filer_link \   cmsplugin_filer_image cmsplugin_filer_teaser cmsplugin_filer_video  \   easy_thumbnails djangocms_text_ckeditor > data.json 
  2. if have created custom permission settings django cms, may need edit data.json remove or of custom settings. in case had cms.pageusergroup instance had created on dev site. referred group not exist on live site , had remove instance data.json dump. otherwise, loaddata command in next step failed integrity error.

  3. you copy data.json live site , issue python manage.py loaddata data.json.

  4. if have files you've added media directory on development site create cms pages, need copy them on live site.

i've used procedure above move data development site live site, no discernible problem.

caveats

  1. the procedure above meant one time deal. won't work if continue making changes development pages , try migrate them on live site.

  2. i've mentioned issues permissions in steps above. least run permission issues if have cms_permissions set false. if set true, may have edit dump instructed above before loading on live site. if you've done heavy customization of permission scheme , have whole bunch of pageusergroup instances , bunch of pages special permissions, etc., run major difficulties. don't know solution short of undoing customization, or editing dump hand make match live site. problem due fact procedure above not dump authentication models (of django.contrib.auth). if in situation can safely load them on live site, adding them dump trick. however, when have live site has been in production , authentication data has changed on time, cannot load authentication models development site overwrite of records (e.g. "admin"'s password change 1 stored in development database).

  3. the method above not move of pages' history. recorded reversion. if wanted move page's history, you'd have add reversion list of apps dump i'm pretty sure have undesirable side-effects: affect data reversion records other apps use in project. (in effect change or erase history of other apps.)


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -