Olaf
Olaf

Reputation: 336

Django Template Error : Template u'base.html' cannot be extended

I get this error when I run a django app (dpaste)

Template error

In template c:\python\projects\mycms\dpaste\templates\dpaste\base.html, error at line 1

Template u'base.html' cannot be extended, because it doesn't exist

1   {% extends "base.html" %}

But the "base.html" do exist in the template directory and it has this one line in it:

{% extends "base.html" %}

What is wrong with that?

Upvotes: 0

Views: 2741

Answers (3)

Gordon Wrigley
Gordon Wrigley

Reputation: 11765

If you meant to say that:

{% extends "base.html" %}

is the only line in the including template, not the base template, then maybe your problem is that "base.html" is relative to the template root.

So if in settings you have:

TEMPLATE_DIRS = ("/home/me/mysite/mytemplates")

and the including template is:

/home/me/mysite/mytemplates/myapp/page.html

and the base template is:

/home/me/mysite/mytemplates/myapp/base.html

then you want to use:

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

At least that's what my problem was when I found this page.

Upvotes: 1

Dan Lorenc
Dan Lorenc

Reputation: 5394

A template can't extend itself.

Upvotes: 1

AlbertoPL
AlbertoPL

Reputation: 11509

Your base.html template cannot extend itself. The problem lies there. Remove that line and replace it with valid html or other Django template tags (or extend some other template).

Upvotes: 3

Related Questions