Search code examples
pythongoogle-app-enginedjango-templates

Cannot extend base.html from parent directory


I have this directory structure:

root:
+pages
 -base.html
 ...
 +en
  -index.html
  ...
index.py
...

When I render index.html from index.py, it says it cannot find base.html.

This is the tag I used in index.html to extend base.html:

{% extends "../base.html" %}

This is the code in index.py:

path = os.path.join(os.path.dirname(__file__), 'pages/it/index.html')
        self.response.out.write(template.render(path, template_values))

Which would be the correct way? I'm using Google web app and Django templates.


Solution

  • You can't use paths like that in the extends tag. But you don't need to - assuming your TEMPLATE_DIRS setting is root/pages, you just do extends "base.html".