Categories
Python Answers

How to pass HTML to template using Python Flask and Jinja2?

Spread the love

Sometimes, we want to pass HTML to template using Python Flask and Jinja2.

In this article, we’ll look at how to pass HTML to template using Python Flask and Jinja2.

How to pass HTML to template using Python Flask and Jinja2?

To pass HTML to template using Python Flask and Jinja2, we can use the safe filter.

For instance, we write

{{ something|safe }}

to render something string as HTML by using the safe filter.

Conclusion

To pass HTML to template using Python Flask and Jinja2, we can use the safe filter.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *