【发布时间】:2012-08-07 16:02:42
【问题描述】:
我在 Django 模板中的多站点层次结构中工作,因此我需要一个主基本模板 (base/base.html),我有几个从中扩展的主模板,例如 base/base_twocol.html。然后我有从这些模板扩展而来的模板,例如base/base_twocol_SECTION。
然后我需要有相同的模板集,它将处理另一个站点,但从这些模板扩展而来,例如another_site/base.html、another_site/base_twocol.html、another_site/base_twocol_SECTION.html。
我们的目标是拥有一组可以为每个站点覆盖的主模板。
所以我有这样的事情:
templates/
base/
base.html
base_twocol.html //extends base.html
base_twocol_SECTION.html // extends base_twocol.html
another_site/
base.html //extends base/base.html
base_twocol.html //extends base/base_twocol.html
base_twocol_SECTION.html //extends base/base_twocol_SECTION.html
super_cool_site/
base.html //extends base/base.html
base_twocol.html //extends base/base_twocol.html
base_twocol_SECTION.html //extends base/base_twocol_SECTION.html
我创建了我的another_site/base.html,并使用了{% extends "base.html" %}语法
但是,当我运行服务器时,我从浏览器收到“未收到数据错误”,从控制台收到“总线错误”。
【问题讨论】:
-
我们可以看到完整的堆栈跟踪吗?
标签: html django django-templates template-inheritance