2010-12-05 11 views
1

這是我的GAE代碼:做的Django在GAE(谷歌應用程序引擎)像 'render_template' 的方法

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這樣的方法?

thnaks

回答