pythondjangotemplatesdjango-templatestemplatetags

"<ExtendsNode: extends "base.html"> must be the first tag in the template." error in Django Templates


I'm using:

{% extends "base.html" %}

I get the following error:

<ExtendsNode: extends "base.html"> must be the first tag in the template.

Can you please help me?


Solution

  • It must be the very first django template tag in your template.

    Documentation says:

    If you use {% extends %} in a template, it must be the first template tag in that template. Template inheritance won't work, otherwise.

    Documentation can be found here