views:

63

answers:

3

I tried launching my Google App Engine app on localhost, and got a Django error I am stuck on.

"TemplateSyntaxError: Template 'base/_base.html' cannot be extended, because it doesn't exist"

I put the templates in a /templates, and then _base.html & index.html in /templates/base . Thanks! Emile @ proudn00b.com

The Error:

Traceback (most recent call last): File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/init.py", line 511, in call handler.get(*groups) File "/Users/emilepetrone/code/thebuswheel/main.py", line 65, in get outstr = template.render(temp, { 'path': path }) ….

….. File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django/django/template/loader_tags.py", line 58, in get_parent raise TemplateSyntaxError, "Template %r cannot be extended, because it doesn't exist" % parent TemplateSyntaxError: Template 'base/_base.html' cannot be extended, because it doesn't exist

Referring to :

def get(self):

    path = self.request.path

    temp = os.path.join(
        os.path.dirname(__file__),
        'templates' + path)

    if not os.path.isfile(temp):
        temp = os.path.join(
            os.path.dirname(__file__),
            'templates/base/index.html')

    outstr = template.render(temp, { 'path': path })        
    self.response.out.write(outstr)
A: 

I think you need to look in your templates. The important part of the traceback is at the end:

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

Do you have a template named 'base/_base.html'? If not, find what other template file is trying to extend it.

jps
Emile Petrone
maybe it would help to show your template and the yaml config file. :-)
jps
The files were too long for stackoverflow so I posted them on the blog ...http://www.proudn00b.com/post/976956081/buswheel-files-4-error
Emile Petrone
+1  A: 

Another thing you can double check is to make sure one of the paths in the TEMPLATE_DIRS setting points to the root directory for your templates.

Also make sure it's a full absolute path in the setting, not relative to the project.

Brian Stoner
A: 

Solution from @jps

rename base/_base.html to just base.html, no subdir. Update index.html with new path.

Emile Petrone