I'm working in a multisite hierarchy in a Django template, whereby I need a master base template (base/base.html
), for which I have several master templates extending from, such as base/base_twocol.html
. And then I have templates that extend from those templates, such as base/base_twocol_SECTION
.
Then I need to have the same set of templates, which will deal with another site, but extending from those templates, such as another_site/base.html
, another_site/base_twocol.html
, another_site/base_twocol_SECTION.html
.
The goal is to have a master set of templates that can be overridden for each site.
So I have something like this:
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
I've created my another_site/base.html
, and used the syntax {% extends "base.html" %}
However when I run the server, I get a "No data received error" from the browser and "Bus error" from the console.
The bus error is being manifested by the naming of the files, because there are two templates of the same name, with one of them trying to extend from the other.
In another_site/base.html, I have
{% extends "base.html" %}
, but this file is also called base.html.So basically, I can't have a tempalte called X, and another tempalte called X which extends template X. Perhaps my question wasn't phrased quite right which is why this wasn't picked up on.
The child template needs to have a unique name. I did this for all of my template files and now it works fine.