django extends problem - the child template is not showing

Which template are you rendering in your view? It should be the child, not the parent.


I am not sure what yout problem is, but you should check the following points :

  • The {% extends %} tage should be the first one in the template file (and put a blank line afterwards to be sure)
  • I think that the reference to the base template is relative to you TEMPLATE_DIR. Try different things like putting both templates at the same level etc.
  • Check all the tags in both templates to be sure that they are all correctly formatted
  • Check the encoding of the files. If it is UTF-8, try to disable the BOM in both files.
  • Maybe it is a problem with your directory setting. Try to hard code the absolute path to check that.

These are the problems I can imagine, but I can't guarantee that it will work.


The answer Daniel Roseman gave is spot on, but there is a quick and easy way around this if pointing to your child template is not practical (as it might not be with more complex projects).

In your child template, remove the {% extends "" %} tags you have that are pointing to your parent.

In your parent template, replace {% block content %} with {% include "path/to/child/template" %}

That's it! Your child template will now load into the block content exactly as if you had rendered it directly.