سؤال

Should be an easy answer but I don't seem to get it.

Django 1.4 used to have 1 folder templates with subfolders for each app. I would then extend the master template by writing:

{% extend "base.html" %} #extending the master
{% extend "app/base.html" %} #extending another template from an app

However, in Django 1.6 documentation each app looks for it's own templates folder:

...we’ll put this one in the application’s template directory (polls/templates) rather than the project’s (templates)...

. Which is all good for modularity. But when I try to extend the base.html of the project (which all apps should extend) I get TemplateDoesNotExist error. I tried to correct the path in different ways but it didn't work:

base.html
templates/base.html
../templates/base.html
../../templates/base.html
../../../templates/base.html
projectname/templates/base.html
projectname/base.html

If you have an idea how to make this work, please let me know.

Cheers! pp

هل كانت مفيدة؟

المحلول

This error usually means that it couldn't find the template you mentioned in the listed directories in settings.TEMPLATE_DIRS. And as you said in your comment, that turned out to be the problem

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top