공부/Flask

[Jinja2 safe필터] render_templete시 html태그 넘기기

래울 2022. 8. 5. 17:38

html태그를 넘겨줄 때, 의도한 것과 다르게 값이 넘어갈때가 있다.

<b> 와 같은 문자들로 자동랜더링되어 넘어간다.

이를 해결하기위해 아래와 같이 |safe를 붙여 사용가능하다.

 

 

 

https://stackoverflow.com/questions/12341496/jinja-2-safe-keyword

 

Jinja 2 safe keyword

I have a little problem understanding what an expression like {{ something.render() | safe }} does . From what I have seen, without the safe keyword it outputs the entire html document, not just the

stackoverflow.com