Can't disable the autoescape in jinja2

浪尽此生 提交于 2019-12-03 23:50:33
hyang123

In order for the autoescape tag to be recognized, you need to enable the autoescape extension when setting up jinja2, like this:

jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir),
                               autoescape = True,
                               extensions = ['jinja2.ext.autoescape'])

Also, make sure you're using jinja2 version 2.4 or higher in your app.yaml (the current version is GAE is 2.6):

libraries:
- name: jinja2
  version: "2.6"

For more information, see the documentation for the autoescape extension.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!