我有一个使用Django CMS的Django应用程序。我使用CMS在应用程序中构建了自定义插件,页面,用户等。我想将CMS数据从我的应用程序导出到同一个应用程序的另一个实例,该实例没有任何cms相关数据。
我使用以下命令:
python manage.py dumpdata cms djangocms_column djangocms_file djangocms_googlemap djangocms_link djangocms_picture djangocms_style djangocms_text_ckeditor djangocms_video > cms_export.json --indent=2
我将该文件复制到另一个应用实例,并尝试使用以下命令加载它:
python manage.py loaddata cms_export.json
我收到以下错误:
django.core.serializers.base.DeserializationError: Problem installing fixture '/cms_export.json': Page has no field named 'path'
cms_export.json片段:
[{
"model": "cms.usersettings",
"pk": 1,
"fields": {
"user": 2,
"language": "en",
"clipboard": 1
}
},
{
"model": "cms.usersettings",
"pk": 2,
"fields": {
"user": 1,
"language": "en",
"clipboard": 7
}
},
{
"model": "cms.page",
"pk": 4,
"fields": {
"path": "0004",
"depth": 1,
"numchild": 0,
"created_by": "script",
"changed_by": "xxxx",
"parent": null,
"creation_date": "2018-01-27T18:51:08.122Z",
"changed_date": "2018-02-04T19:48:21.804Z",
"publication_date": "2018-01-27T18:52:43.340Z",
"publication_end_date": null,
"in_navigation": true,
"soft_root": false,
"reverse_id": null,
"navigation_extenders": null,
"template": "base.html",
"site": 1,
"login_required": false,
"limit_visibility_in_menu": null,
"is_home": true,
"application_urls": "",
"application_namespace": null,
"publisher_is_draft": true,
"publisher_public": 5,
"languages": "en",
"revision_id": 0,
"xframe_options": 0,
"placeholders": [
3,
9
]
}
},
{
"model": "cms.page",
"pk": 5,
"fields": {
"path": "0005",
"depth": 1,
"numchild": 0,
"created_by": "admin",
"changed_by": "xxxx",
"parent": null,
"creation_date": "2018-01-27T18:52:43.345Z",
"changed_date": "2018-02-04T19:48:21.792Z",
"publication_date": "2018-01-27T18:52:43.340Z",
"publication_end_date": null,
"in_navigation": true,
"soft_root": false,
"reverse_id": null,
"navigation_extenders": null,
"template": "base.html",
"site": 1,
"login_required": false,
"limit_visibility_in_menu": null,
"is_home": true,
"application_urls": "",
"application_namespace": null,
"publisher_is_draft": false,
"publisher_public": 4,
"languages": "en",
"revision_id": 0,
"xframe_options": 0,
"placeholders": [
4,
8
]
}
},
{
"model": "cms.page",
"pk": 10,
"fields": {
"path": "0007",
"depth": 1,
"numchild": 0,
"created_by": "script",
"changed_by": "xxxx",
"parent": null,
"creation_date": "2018-01-31T19:56:22.494Z",
"changed_date": "2018-02-04T18:49:06.843Z",
"publication_date": "2018-01-31T19:57:23.405Z",
"publication_end_date": null,
"in_navigation": true,
"soft_root": false,
"reverse_id": null,
"navigation_extenders": null,
"template": "base.html",
"site": 1,
"login_required": false,
"limit_visibility_in_menu": null,
"is_home": false,
"application_urls": null,
"application_namespace": null,
"publisher_is_draft": true,
"publisher_public": 11,
"languages": "en",
"revision_id": 0,
"xframe_options": 0,
"placeholders": [
26
]
}
},]
提前致谢。
答案 0 :(得分:0)
您可以从要转储的实例和要导入的实例共享cms.page模型的架构吗?您的错误是声称cms.page没有'路径'字段,这可能意味着模型可能没有您期望的模式。
答案 1 :(得分:0)
我可以回答这个问题。感谢@tinwhiskers
几天前,Divio团队推出了稳定的3.5版django-cms。我的旧实例正在使用3.4.5和我试图加载灯具的新实例使用的是3.5.0
由于这个原因,我的模型存在冲突。
在我的新实例上降级到3.4.5并且能够成功安装灯具。
希望这可以帮助任何面临同样问题的人!