title: Django: specifying a base template by directory
body: <p>I'm working on a Django site that has multiple sections and subsections. I'd like to have several depths of template inheritance: a base template for the whole site, one base template for each section that inherits from the root base template, and so on. Here's a simplified version of my desired directory structure:</p>
  
  <pre><code>base.html
  section1/
    base.html
  section2/
    base.html
  section3/
    base.html
  </code></pre>
  
  <p>What I would desire is for all the files under <code>section1/</code> to contain something like <code>{% extends "base.html" %}</code>, meaning they would extend <code>section1/base.html</code>. <code>section1/base.html</code> would contain something like <code>{% extends "../base.html" %}</code>, meaning that it would extend the root-level base file. However, I couldn't find anything in the documentation suggesting this was possible, and I couldn't get Django to distinguish between <code>"../base.html"</code> and <code>"base.html"</code>. (<code>{% extends "../base.html" %}</code> throws an error.) I suppose one workaround would be to rename all base files <code>base_SECTIONNAME.html</code>, and update all the files that inherit from them, but I am concerned that this might become difficult to maintain as my site becomes bigger and sections change names, etc. I would prefer a solution that takes advantage of the natural hierarchy specified by directories and subdirectories.</p>
  
  <p>Any ideas?</p>