我正在自学如何使用 Aldryn 来托管 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_template 时,日志给了我同样的错误。
我已经按照教程告诉我的方式设置了项目。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_plugins.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)
...它看起来对我来说,但也许我错过了一些东西。