这是我的 gae 代码:
class BaseRequestHandler(webapp.RequestHandler):
def render_template(self, filename, template_values={}):
values={
}
template_values.update(values)
path = os.path.join(os.path.dirname(__file__), 'templates', filename)
self.response.out.write(template.render(path, template_values))
class CounterHandler(BaseRequestHandler):
def get(self):
self.render_template('counters.html',{'counters': Counter.all()})
django有这个方法吗?
如何在 django 中创建类似 render_template
的方法?
最佳答案
是的,它称为render_to_response
,解释如下:
关于python - django在gae(谷歌应用引擎)中是否有类似 'render_template'的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4357358/