ImportError: cannot import name 'import_string' from 'werkzeug'
aaronjolson opened this issue · 3 comments
aaronjolson commented
I am trying to run my app, getting an error
ImportError: cannot import name 'import_string' from 'werkzeug'
The error is from
venv/lib/python3.7/site-packages/flask_cache/__init__.py", line 24, in <module>
from werkzeug import import_string
I am running Python 3.7
pip freeze says
Werkzeug==1.0.1
Flask==1.1.1
Flask-Cache==0.13.1
redis==3.5.3
Anyone else run into this error? Anyone know of a fix?
touilleMan commented
For anyone stumbling into this issue, here is the quick'n dirty way to solve this:
# Monkeypatch to fix import in flask-cache
from werkzeug.utils import import_string
import werkzeug
werkzeug.import_string = import_string
import flask_cache # Obviously flask_cache must be imported after the monkeypatch