FeinCMS初始安装:模板

时间:2013-07-31 16:03:17

标签: django django-templates feincms

所以我试图让FeinCMS启动并运行,我让它在后端工作,但我无法加载页面:

这就是我的models.py设置方式:

Page.register_templates({
    'title': _('Standard template'),
    'path': 'base.html',
    'regions': (
        ('main', _('Main content area')),
        ('sidebar', _('Sidebar'), 'inherited'),
        ),
    })

Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
    ('lightbox', _('lightbox')),
    ))

我得到的错误是

TemplateDoesNotExist at /test/

zipfel/base.html

Django tried loading these templates, in this order:

Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
    /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/templates/zipfel/base.html (File does not exist)
    /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/templates/zipfel/base.html (File does not exist)
    /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admindocs/templates/zipfel/base.html (File does not exist)
    /Library/Python/2.7/site-packages/feincms/templates/zipfel/base.html (File does not exist)
    /Library/Python/2.7/site-packages/mptt/templates/zipfel/base.html (File does not exist)

现在我明白,如果我将base.html文件放在其中任何一个目录中,它应该可以工作。

2个问题:

base.html内容需要是什么? 为了能够将base.html放在app文件夹中,我是否必须将该路径添加到TEMPLATE_DIRS?

到目前为止,FeinCMS安装对我来说相当棘手

1 个答案:

答案 0 :(得分:0)

我添加了TEMPLATE_DIRS的绝对路径,这使我可以将base.html放在我想要的地方

在该文件中我放置了以下代码,我能够查看我的页面:

{% load feincms_tags %}

<div id="content">
    {% block content %}
    {% for content in feincms_page.content.main %}
        {{ content.render }}
    {% endfor %}
    {% endblock %}
</div>

<div id="sidebar">
    {% block sidebar %}
    {% for content in feincms_page.content.sidebar %}
        {{ content.render }}
    {% endfor %}
    {% endblock %}
</div>