flask_uploads: ImportError: cannot import name 'secure_filename'
In flask_uploads.py
Change
from werkzeug import secure_filename,FileStorage
to
from werkzeug.utils import secure_filename
from werkzeug.datastructures import FileStorage
You are using a broken version of Flask-Uploads
.
Unfortunately, the maintainer of the package decided not to release a new version of the package to PyPi.
You can use Flask-Reuploaded
as a drop-in replacement, which fixes your problem.
https://pypi.org/project/Flask-Reuploaded/
According to this issue, it is a bug related to the current version 1.0.0 of workzeug. It's merged but not yet published in pypi.
The workaround know until now is to downgrade from werkzeug=1.0.0
to werkzeug==0.16.0
So for do that you just need run the command:
pip install -U Werkzeug==0.16.0
Looking in the release notes from werkzeug there is a version 0.16.1
, but in bug report there is no evidence that using that version could be of any help.