奥尔德林你好世界

2024-03-28 11:40:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我在自学如何使用奥尔德林主持django cms网站。我一直在浏览readthedocs网站上的应用程序开发教程,几乎一直到最后。当我运行aldryn project up时,我得到一个错误,告诉我检查日志。我使用docker-compose logs web检查日志,在日志末尾我看到:django.core.exceptions.ImproperlyConfigured: CMS Plugins must define a render template (<class 'hello_world_ct.cms_plugins.HelloWorld'>) that exists: hello_world_ct/hello.html

出于某种原因,aldryn项目似乎无法识别我在class HelloWorld(CMSPluginBase):中定义了一个呈现模板的脸。当我注释掉render\u模板时,日志会给出相同的错误。你知道吗

我已经完全按照教程的要求设置了这个项目。addons dev文件夹中的目录树如下所示:

hello-world-ct/
├── addon.json
├── hello_world_ct
│   ├── admin.py
│   ├── cms_plugins.py
│   ├── cms_plugins.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── migrations
│   │   └── __init__.py
│   ├── models.py
│   ├── models.pyc
│   ├── templates
│   │   └── hello_world_ct
│   │       └── hello.html
│   ├── tests.py
│   └── views.py
├── LICENSE
├── MANIFEST.in
├── README.rst
└── setup.py

cms系统_插件.py文件看起来像:

from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin

class HelloWorld(CMSPluginBase):
    model = CMSPlugin
    render_template = "hello_world_ct/hello.html"
    text_enabled = True

plugin_pool.register_plugin(HelloWorld)

。。。在我看来是对的,但也许我遗漏了什么。你知道吗


Tags: pyhelloworldcmsinitmodelshtmlplugins