3

I know jinja2 is the default built-in template engine for Flask. My question is:

Is it possible to integreate Chameleon with Flask ?

If so, how can I do that ?

This is how I did. I wrap the response string in a method..

from chameleon import PageTemplate

def execute_page(template_str, page):
    # Irrelevant
    template = PageTemplate(template_str)
    return template.render(page=page)

then consume the method and return the HTTPResponse. Hence, I completely skip render_template(template_file_name) approach.

My question is: Is it the proper (Pythonic, Flask) way to do?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Khanh Hua
  • 1,086
  • 1
  • 14
  • 22
  • I think your question is too broad, here in SO it's good manner to show you at least did an effort to try and solve your own problem, then give some notes about your approach. This will help the community give you a hand. – G4bri3l Jun 14 '15 at 15:13
  • 1
    See [this answer](http://librelist.com/browser/flask/2010/11/28/chameleon-on-flask/#d8172d59a82de83f8c76bef1c528df8f) to the same question. – doru Jun 14 '15 at 15:51

0 Answers0