views:

1153

answers:

3

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?

+3  A: 

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).

AlbertoPL
I replaced '{% extends "base.html" %}' with <h1>DPaste Sample App</h1>. Well, that nasty error disappeared. But, now all I can see is 'DPaste Sample App'!!But the application should have displayed a first page with some input forms etc.. (Just like dpaste.com)
Olaf
I hope you replaced that in the base.html page and not the other page. Does base.html have all the forms etc. that you want?
AlbertoPL
@AlbertoPL : Yes, I did it in base.html file and there is no other html elements in it other than '<h1>DPaste Sample App</h1>'. An SVN copy of the base.html is here >> http://bit.ly/yQk3iSo, I must add form elements in base.html, yes?I'm a beginner to DJango. Still learning by doing some coding and looking at the source code of sample applications.And your hints helped a lot!
Olaf
+1  A: 

A template can't extend itself.

Dan Lorenc
A: 

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.

tolomea