Why do we need Jinja 2? Sandboxed Execution: It provides a protected framework for automation of testing programs, whose behaviour is unknown and must be investigated. HTML Escaping: Jinja 2 has a powerful automatic HTML Escaping, which helps preventing Cross-site Scripting (XSS Attack).