9阅网

您现在的位置是:首页 > 知识 > 正文

知识

python - 检查未保存的django-cms插件实例。

admin2022-10-27知识17

我有一个django-cms实例,我们最近从v2.4.3迁移到v3.0.12。我们现在正在努力让它100%稳定。

我运行了以下命令

管理.py cms检查

并得到了一些错误。我可以理解所有的错误,但以下的错误。

Plugin instances
================

  - Plugin instances of 72 types found in the database [OK]
  - DepartmentTitlePlugin has 2 unsaved instances [ERROR]
  - PicturePlugin has 5 unsaved instances [ERROR]

There are potentially serious problems with the plugins in your database. 
Even if your site works, you should run the 'manage.py cms list plugins' 
command and then the 'manage.py cms delete_orphaned_plugins' command. 
This will alter your database; read the documentation before using it. [ERROR]

谁能解释一下这个错误的含义?我担心delete_orphaned_plugins会删除一些重要的插件,所以不是一个好的解决方案。我真的不知道该怎么做。

有什么反馈吗?谢谢:-)

.sogeking



【回答】:

如果你在前台编辑器中创建了一个新插件,但没有保存就关闭了窗口,就会出现这种未保存或孤儿插件。我们一直在努力不创建 "未保存 "的实例,但这很复杂,至少在3.2版本之前是做不到的。

尽管如此,运行以下程序应该是安全的 python manage.py cms delete-orphaned-plugins --noinput 以删除未保存的实例。不过,在运行之前,请确保您有一个有效的数据库备份。