【发布时间】:2011-09-25 05:32:45
【问题描述】:
我正在尝试让template.render()(导入为:from google.appengine.ext.webapp import template)使用位于应用程序根目录以外的目录中的模板。
我有一个名为static 的目录,我想在其中保存我的模板。或者,我稍后会将其更改为 static/templates,但这并不重要。
问题? TemplateDoesNotExist: index.html,可悲的例外。
这个:
path = os.path.join(os.path.dirname(__file__), 'index.html')
logging.debug(path)
self.response.out.write(template.render(path, template_values))
.. 有效,但是这个:
path = os.path.join(os.path.dirname(__file__), 'static/index.html')
logging.debug(path)
self.response.out.write(template.render(path, template_values))
.. 没有。
/static 已添加到 app.yaml,尽管它应该无关紧要。
感谢您的建议。
【问题讨论】:
标签: django google-app-engine templates