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:
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 sitecms
, 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
if have created custom permission settings django cms, may need edit
data.json
remove or of custom settings. in case hadcms.pageusergroup
instance had created on dev site. referred group not exist on live site , had remove instancedata.json
dump. otherwise,loaddata
command in next step failed integrity error.you copy
data.json
live site , issuepython manage.py loaddata data.json
.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
the procedure above meant one time deal. won't work if continue making changes development pages , try migrate them on live site.
i've mentioned issues permissions in steps above. least run permission issues if have
cms_permissions
setfalse
. if settrue
, may have edit dump instructed above before loading on live site. if you've done heavy customization of permission scheme , have whole bunch ofpageusergroup
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 (ofdjango.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).the method above not move of pages' history. recorded
reversion
. if wanted move page's history, you'd have addreversion
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
Post a Comment