With the latest jinja2
bump version to 3.0.0
, I started running into this error in my Flask
application:
.../anaconda3/envs/env/lib/python3.8/site-packages/jinja2/environment.py:119: DeprecationWarning: The 'autoescape' extension is deprecated and will be removed in Jinja 3.1. This is built in now.
result[extension.identifier] = extension(environment)
.../anaconda3/envs/env/lib/python3.8/site-packages/jinja2/environment.py:119: DeprecationWarning: The 'with' extension is deprecated and will be removed in Jinja 3.1. This is built in now.
result[extension.identifier] = extension(environment)
For the record, my current Flask
version is 1.1.2
.
Simply upgrade your Flask
application to the latest version - 2.0.0
:
pip install Flask --ignore-installed
That should solve the issue.
However, if upgrading the version is not an option, as an alternative on can just clear the default jinja2
extensions that are initially loaded by Flask
by doing:
app = Flask(__name__)
app.jinja_options = {}
...
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.