Django-CMS 插件未出现
我正在部署 Django 网站。我在计算机上运行的所有自定义插件(我可以从下拉列表中将它们添加到模板块中。)但是当我将代码推送到站点时,并非所有插件都可用。
数据库表已创建,如果我导入 plugin_pool
并调用 discover_plugins()
然后调用 get_all_plugins()
插件都会显示出来。所以我的问题是,为什么我的插件没有显示?有什么想法吗?
I'm deploying a Django website. All the custom plugins I have work on my computer (I can add them into a template block from the drop down.) but when I push the code out to the site, not all the plugins are available.
The database tables are created, and if I import plugin_pool
and call discover_plugins()
and then get_all_plugins()
the plugins all show up. So my question is, why aren't my plugins showing? Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的应用是否在
INSTALLED_APPS
中使用了插件(cms_plugins.py
文件)?它是否有
models.py
(可能为空)文件?使用
python manage.py shell
时可以导入cms_plugins.py
文件吗?最常见的问题是 cms_plugins.py 文件中的导入错误
Is your app with the plugin (
cms_plugins.py
file) inINSTALLED_APPS
?Does it have a
models.py
(which could be empty) file?Can you import the
cms_plugins.py
file when usingpython manage.py shell
?The most common problem are import errors in the cms_plugins.py file
我在遵循 Django CMS 3 的基本示例时遇到了此问题该示例表明以下代码将起作用(使用相关模板):
但是,我发现当使用
CMSPlugin
作为模型时,插件在页面结构编辑器中不可见。尽管插件位于以下位置:
INSTALLED APPS
中列出的应用程序的根目录中models.py
文件(但插件未使用任何这些模型)cms_plugins.py
文件尝试 django shell 导入,如示例页面中列出的:
解决方案是使用定义在这
models.py
文件,它扩展了 CMSPlugin:就像魔术一样,该插件随后列在页面结构编辑器的“Generic”下。
I encountered this issue while following the basic example for Django CMS 3. The example suggests that the following code will work (with the associated template in place):
However, I found that when using
CMSPlugin
as the model the plugin is not visible in the page structure editor.This is despite the fact that the Plugin is:
INSTALLED APPS
models.py
file (but the plugin was not using any of those models)cms_plugins.py
file could be imported from a django shellTry the django shell import, as listed on the example page:
The solution was to use a model defined in the
models.py
file, which extends CMSPlugin:Like magic, the plugin was then listed under 'Generic' on the page structure editor.