使用 djangocms 发布页面更改时出现“NodeAlreadySaved”错误

jpx*_*jpx 8 python django mod-wsgi django-cms apache2.4

使用djangocms发布页面更改时遇到错误。

当我跑时tail -f /var/log/apache2/error.log,它返回:

treebeard.exceptions.NodeAlreadySaved: Attempted to add a tree node that is already in the database, referer: http://47.95.254.172/?edit
Run Code Online (Sandbox Code Playgroud)

当我允许 settings.py DEBUG= True 并单击“发布页面更改”按钮时:

NodeAlreadySaved at /admin/cms/page/1/en/publish/
Attempted to add a tree node that is already in the database
Request Method: POST
Request URL:    http://47.95.254.172/admin/cms/page/1/en/publish/
Django Version: 3.1.7
Exception Type: NodeAlreadySaved
Exception Value:    Attempted to add a tree node that is already in the database
Exception Location: /root/env1/lib/python3.8/site-packages/treebeard/mp_tree.py, line 326, in process
Python Executable:  /root/env1//bin/python
Python Version: 3.8.5

Run Code Online (Sandbox Code Playgroud)

我跑了,python manage.py cms fix-tree但没有用。同时python manage.py cms check返回10 个检查成功!.

我部署了 djangocms 项目:

apache2.4.41

mod-wsgi 4.8.0

Django 3.1.7

django-cms 3.8.0

venv中python版本是3.8.5,mod-wsgi是venv中python3.8.5编译的。

感谢您的帮助!

小智 13

降级到 4.5.1 以下的 django-treebeard 版本,例如 4.4。版本 4.5.1 似乎不兼容。

pip install django-treebeard==4.4
Run Code Online (Sandbox Code Playgroud)


sly*_*oty 6

您还可以修改该requirements.txt文件以反映不同的django-treebeard版本4.5.1

django-treebeard>=4.0,!=4.5.1
Run Code Online (Sandbox Code Playgroud)

然后你可以运行:

pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)