Cannot extend base.html from parent directory

I have this directory structure:

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

when i output 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)) 

what would be the right way? I am using google webapp and djagno templates.

+4
source share
2 answers

You cannot use such paths in the extends tag. But you do not need to - if your TEMPLATE_DIRS parameter is equal to root/pages , you just do extends "base.html" .

+2
source

I answered this question very similar to this question: TemplateDoesNotExist on python app-engine django 1.2, while relative paths for displaying templates

The technique presented there will allow you to fully control the directory structure in which you store your templates.

0
source

All Articles