【问题标题】:does django has a method like 'render_template' in gae (google app engine)django 在 gae (谷歌应用引擎)中是否有类似“render_template”的方法
【发布时间】:2011-05-20 10:22:14
【问题描述】:

这是我的 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 的方法?

感谢

【问题讨论】:

    标签: python django google-app-engine


    【解决方案1】:

    是的,它叫render_to_response,这里有解释:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-21
      • 2013-08-29
      • 2011-04-20
      • 2012-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多