如何解决使用 djangocms 发布页面更改时出现“NodeAlreadySaved”错误
使用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
当我允许 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
我已经运行了 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编译的。
感谢您的帮助!
解决方法
降级到4.5.1以下的django-treebeard版本,例如4.4. 4.5.1 版本似乎不兼容。
pip install django-treebeard==4.4
,
您还可以修改 requirements.txt
文件以反映不是 django-treebeard
的其他 4.5.1
版本:
django-treebeard>=4.0,!=4.5.1
然后你可以运行:
pip install -r requirements.txt
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。