Skip to content

Commit

Permalink
import/export of cms data works, see README
Browse files Browse the repository at this point in the history
  • Loading branch information
EsGeh authored and EsGeh committed Nov 29, 2019
1 parent be67fa7 commit 6b1d7f6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,20 @@ Dependencies to other git repositories are handled using [git_deps_py](https://g
This will pull remote repositories and resources, initialize the database, etc.
Force recreating the docker image by adding `--build` e.g. if `Dockerfile` or `requirements.txt` has changed.

## Import Publications, Initialize CMS pages (TODO)
## Import data

### Initialize CMS pages

The dummy fixture contains the default setup for CMS pages.
Also a CMS superuser with username 'test' and password 'test' (don't use this in production !).

$ cp fixtures/cms_dummy.json res/fixtures/
$ ./scripts/init.py --skip-db
$ ./scripts/run.py && ./scripts/exec_in_container.py
$ $ python manage.py loaddata $RES_DIR/fixtures/cms_dummy.json
$ $ exit

### Import Publications

In order to publish a publication on the platform, the following 2 steps are necessary:

Expand Down Expand Up @@ -94,6 +107,13 @@ The webpage can now be explored in your local browser.
This should remove all remote repositories and resources not part of this repository.
Docker images are not deleted though.

## Export Data

In order to export CMS content, execute:

$ ./scripts/run.py && ./scripts/exec_in_container.py 'python manage.py dump_cms'
$ cp runtime_data/fixtures/* fixtures/

# Installation for Production (TODO)

Not documented yet.
Expand Down
1 change: 1 addition & 0 deletions fixtures/cms_dummy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"model": "cms.treenode", "pk": 1, "fields": {"path": "0001", "depth": 1, "numchild": 0, "parent": null, "site": ["example.com"]}}, {"model": "cms.treenode", "pk": 2, "fields": {"path": "0002", "depth": 1, "numchild": 0, "parent": null, "site": ["example.com"]}}, {"model": "cms.treenode", "pk": 3, "fields": {"path": "0003", "depth": 1, "numchild": 0, "parent": null, "site": ["example.com"]}}, {"model": "cms.page", "pk": 1, "fields": {"created_by": "test", "changed_by": "test", "creation_date": "2019-11-29T12:08:47.672Z", "changed_date": "2019-11-29T13:13:29.142Z", "publication_date": "2019-11-29T12:08:47.695Z", "publication_end_date": null, "in_navigation": true, "soft_root": false, "reverse_id": "intropage", "navigation_extenders": null, "template": "INHERIT", "login_required": false, "limit_visibility_in_menu": null, "is_home": true, "application_urls": "", "application_namespace": null, "publisher_is_draft": true, "publisher_public": 2, "languages": "en", "xframe_options": 0, "is_page_type": false, "node": 1, "placeholders": [2]}}, {"model": "cms.page", "pk": 2, "fields": {"created_by": "test", "changed_by": "test", "creation_date": "2019-11-29T12:08:47.695Z", "changed_date": "2019-11-29T13:13:32.947Z", "publication_date": "2019-11-29T12:08:47.695Z", "publication_end_date": null, "in_navigation": true, "soft_root": false, "reverse_id": "intropage", "navigation_extenders": null, "template": "INHERIT", "login_required": false, "limit_visibility_in_menu": null, "is_home": true, "application_urls": "", "application_namespace": null, "publisher_is_draft": false, "publisher_public": 1, "languages": "en", "xframe_options": 0, "is_page_type": false, "node": 1, "placeholders": [3]}}, {"model": "cms.page", "pk": 3, "fields": {"created_by": "test", "changed_by": "test", "creation_date": "2019-11-29T13:13:49.249Z", "changed_date": "2019-11-29T13:14:00.776Z", "publication_date": "2019-11-29T13:14:51.913Z", "publication_end_date": null, "in_navigation": true, "soft_root": false, "reverse_id": "contact", "navigation_extenders": null, "template": "INHERIT", "login_required": false, "limit_visibility_in_menu": null, "is_home": false, "application_urls": "", "application_namespace": null, "publisher_is_draft": true, "publisher_public": 5, "languages": "en", "xframe_options": 0, "is_page_type": false, "node": 2, "placeholders": [4]}}, {"model": "cms.page", "pk": 4, "fields": {"created_by": "test", "changed_by": "test", "creation_date": "2019-11-29T13:14:21.676Z", "changed_date": "2019-11-29T13:14:33.150Z", "publication_date": "2019-11-29T13:14:57.380Z", "publication_end_date": null, "in_navigation": true, "soft_root": false, "reverse_id": "imprint", "navigation_extenders": null, "template": "INHERIT", "login_required": false, "limit_visibility_in_menu": null, "is_home": false, "application_urls": "", "application_namespace": null, "publisher_is_draft": true, "publisher_public": 6, "languages": "en", "xframe_options": 0, "is_page_type": false, "node": 3, "placeholders": [5]}}, {"model": "cms.page", "pk": 5, "fields": {"created_by": "test", "changed_by": "test", "creation_date": "2019-11-29T13:14:51.914Z", "changed_date": "2019-11-29T13:14:51.914Z", "publication_date": "2019-11-29T13:14:51.913Z", "publication_end_date": null, "in_navigation": true, "soft_root": false, "reverse_id": "contact", "navigation_extenders": null, "template": "INHERIT", "login_required": false, "limit_visibility_in_menu": null, "is_home": false, "application_urls": "", "application_namespace": null, "publisher_is_draft": false, "publisher_public": 3, "languages": "en", "xframe_options": 0, "is_page_type": false, "node": 2, "placeholders": [6]}}, {"model": "cms.page", "pk": 6, "fields": {"created_by": "test", "changed_by": "test", "creation_date": "2019-11-29T13:14:57.380Z", "changed_date": "2019-11-29T13:14:57.380Z", "publication_date": "2019-11-29T13:14:57.380Z", "publication_end_date": null, "in_navigation": true, "soft_root": false, "reverse_id": "imprint", "navigation_extenders": null, "template": "INHERIT", "login_required": false, "limit_visibility_in_menu": null, "is_home": false, "application_urls": "", "application_namespace": null, "publisher_is_draft": false, "publisher_public": 4, "languages": "en", "xframe_options": 0, "is_page_type": false, "node": 3, "placeholders": [7]}}, {"model": "cms.placeholder", "pk": 1, "fields": {"slot": "clipboard", "default_width": null}}, {"model": "cms.placeholder", "pk": 2, "fields": {"slot": "content", "default_width": null}}, {"model": "cms.placeholder", "pk": 3, "fields": {"slot": "content", "default_width": null}}, {"model": "cms.placeholder", "pk": 4, "fields": {"slot": "content", "default_width": null}}, {"model": "cms.placeholder", "pk": 5, "fields": {"slot": "content", "default_width": null}}, {"model": "cms.placeholder", "pk": 6, "fields": {"slot": "content", "default_width": null}}, {"model": "cms.placeholder", "pk": 7, "fields": {"slot": "content", "default_width": null}}, {"model": "cms.title", "pk": 1, "fields": {"language": "en", "title": "Introduction", "page_title": "", "menu_title": "", "meta_description": "", "slug": "intropage", "path": "", "has_url_overwrite": false, "redirect": null, "page": 1, "creation_date": "2019-11-29T12:08:47.674Z", "published": true, "publisher_is_draft": true, "publisher_public": 2, "publisher_state": 0}}, {"model": "cms.title", "pk": 2, "fields": {"language": "en", "title": "Introduction", "page_title": "", "menu_title": "", "meta_description": "", "slug": "intropage", "path": "", "has_url_overwrite": false, "redirect": null, "page": 2, "creation_date": "2019-11-29T12:08:47.674Z", "published": true, "publisher_is_draft": false, "publisher_public": 1, "publisher_state": 0}}, {"model": "cms.title", "pk": 3, "fields": {"language": "en", "title": "Contact", "page_title": "", "menu_title": "", "meta_description": "", "slug": "contact", "path": "contact", "has_url_overwrite": false, "redirect": null, "page": 3, "creation_date": "2019-11-29T13:13:49.250Z", "published": true, "publisher_is_draft": true, "publisher_public": 5, "publisher_state": 0}}, {"model": "cms.title", "pk": 4, "fields": {"language": "en", "title": "Imprint", "page_title": "", "menu_title": "", "meta_description": "", "slug": "imprint", "path": "imprint", "has_url_overwrite": false, "redirect": null, "page": 4, "creation_date": "2019-11-29T13:14:21.677Z", "published": true, "publisher_is_draft": true, "publisher_public": 6, "publisher_state": 0}}, {"model": "cms.title", "pk": 5, "fields": {"language": "en", "title": "Contact", "page_title": "", "menu_title": "", "meta_description": "", "slug": "contact", "path": "contact", "has_url_overwrite": false, "redirect": null, "page": 5, "creation_date": "2019-11-29T13:13:49.250Z", "published": true, "publisher_is_draft": false, "publisher_public": 3, "publisher_state": 0}}, {"model": "cms.title", "pk": 6, "fields": {"language": "en", "title": "Imprint", "page_title": "", "menu_title": "", "meta_description": "", "slug": "imprint", "path": "imprint", "has_url_overwrite": false, "redirect": null, "page": 6, "creation_date": "2019-11-29T13:14:21.677Z", "published": true, "publisher_is_draft": false, "publisher_public": 4, "publisher_state": 0}}, {"model": "cms.urlconfrevision", "pk": 1, "fields": {"revision": "6e5ea056-b6bc-4694-900e-092b351f435b"}}, {"model": "auth.user", "fields": {"password": "pbkdf2_sha256$120000$awAbMKkwkX38$+knkN0z9J0d827BLrNXmUgS+WyxuWhSMZX5Z05XlLbc=", "last_login": "2019-11-29T13:10:55.951Z", "is_superuser": true, "username": "test", "first_name": "", "last_name": "", "email": "", "is_staff": true, "is_active": true, "date_joined": "2019-11-29T12:12:57.234Z", "groups": [], "user_permissions": []}}, {"model": "cms.usersettings", "pk": 1, "fields": {"user": ["test"], "language": "en", "clipboard": 1}}]
10 changes: 9 additions & 1 deletion src/eoa/management/commands/dump_cms.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ def handle(self, *args, **options):
)

call_command(
"dumpdata", "cms",
"dumpdata",
"cms",
"djangocms_text_ckeditor",
"auth.user",
exclude = [
"contenttypes",
"auth.Permission",
],
natural_foreign = True,
natural_primary = True,
output = output_file
)
logger.info( "done" )
Expand Down

0 comments on commit 6b1d7f6

Please sign in to comment.