2011-06-29 21 views
1

我试图使template.render()(导入为:from google.appengine.ext.webapp import template)使用位于应用程序根目录以外的目录中的模板。AppEngine:从静态目录加载模板(不只是'/')

我有一个目录,名为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,但它应该没有关系。

感谢您的任何建议。

回答