我試圖在本地主機上啓動我的Google App Engine應用程序,並且遇到了Django錯誤。Google App Engine中的Django模板語法錯誤
「TemplateSyntaxError:模板‘基地/ _base.html’不能擴展,因爲它不存在」
我把模板在/模板,然後_base.html &的index.html在/模板/基地。謝謝! 埃米爾@proudn00b.com
的錯誤:
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
參考:
高清得到(個體經營):
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)
我確實有base/_base.html文件,這是唯一的模板文件。 Def部分挫折 – Emile 2010-08-18 22:59:33
也許它會幫助顯示你的模板和yaml配置文件。 :-) – jps 2010-08-19 01:14:23
這些文件對於計算器來說太長了,所以我把它們發佈到了博客上... http://www.proudn00b.com/post/976956081/buswheel-files-4-error – Emile 2010-08-19 12:20:20