How to integrate Chameleon with Flask?

I know jinja2 is Flask's built-in default templating engine. My question is:

Can a chameleon be combined with a flask?

If so, how can I do this?

So I did. I am terminating the response line in a method.

from chameleon import PageTemplate

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

      

then use the method and return HTTPResponse. Hence I am skipping the approach entirely render_template(template_file_name)

.

My question is: is this correct (Pythonic, Flask)?

+3
python flask chameleon


source to share


No one has answered this question yet

Check out similar questions:

5116
How can I check if a file exists without exceptions?
4268
How to combine two dictionaries in one expression?
3790
How can I safely create a subdirectory?
3474
How to list all files in a directory?
3428
How do I sort a dictionary by value?
3235
How to check if a list is empty?
2621
How do I chain function decorators?
2601
How can I make a time delay in Python?
2568
How to find the current time in Python
597
Get data received in Flask request



All Articles
Loading...
X
Show
Funny
Dev
Pics