does django has a method like 'render_template' in gae (google app engine)
This is my gae code:
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()})
Does django has this method?
How to make a method likerender_template
in django?Yes, it's called render_to_response
, and is explained here:
http://docs.djangoproject.com/en/dev/topics/http/shortcuts/
精彩评论