简体   繁体   中英

How to return raw html in a Flask app bypassing template transformations

I have just started building my first Flask app, which currently simply returns output of inspect for my objects inside table tags. The problem is that instead of the html I expect, a template engine messes layout up creating new tags (I guess it parses dict's curly brackets).

From your question I don't really understand, why and where this inspect is ran, but it is possible to escape output like this:

{{ object | e }}

Or you can escape things inside template by using 'foo' or {% raw %} :

{{ '{{' }}

{% raw %}
   {% %}
{% endraw %}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM