开发者

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 like render_template in django?


Yes, it's called render_to_response, and is explained here:

http://docs.djangoproject.com/en/dev/topics/http/shortcuts/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜