Reputation: 967
I'm teaching myself how to use Aldryn to host a django-cms website. I've been working though the application development tutorial on the readthedocs site and I've gotten almost all the way to the end. When I run aldryn project up
I get an error that tells me to check the logs. I check the logs using docker-compose logs web
and at the end of the log I see: 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
For some reason the aldryn project doesn't seem to recognize the face that I have a render_template defined inside the class HelloWorld(CMSPluginBase):
. When I comment out the render_template the log gives me the same error.
I've setup the project EXACTLY as the tutorial tells me to. The directory tree inside the addons-dev folder is like this:
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
The cms_plugins.py file looks like:
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)
... it looks right to me but perhaps I'm missing something.
Upvotes: 3
Views: 145
Reputation: 78
I've got the same problem. Here's the solution that worked for me.
In the settings.py
file, add the template folder of your app to TEMPLATES
variable:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'your_core_app', 'core_app_templates_folder'),
os.path.join(BASE_DIR, 'hello_world_ct', 'templates'),
],
'OPTIONS': {
...
},
},
]
And add the template name to the CMS_TEMPLATES
variable:
CMS_TEMPLATES = (
('fullwidth.html', 'Fullwidth'),
...
('hello.html', 'Hello World CT'),
Upvotes: 0