I received error when i just to try to import UploadSet,configure_uploads, IMAGES from flask uploads.
i don't do any other steps yet
just i save file i received this error
Traceback (most recent call last):
File "C:\Users\ahmed\Desktop\login\main.py", line 14, in <module>
from flask_uploads import UploadSet,configure_uploads, IMAGES
File "C:\Users\ahmed\AppData\Local\Programs\Python\Python39\lib\site-packages\flask_uploads.py", line 26, in <module>
from werkzeug import secure_filename, FileStorage
ImportError: cannot import name 'secure_filename' from 'werkzeug' (C:\Users\ahmed\AppData\Local\Programs\Python\Python39\lib\site-packages\werkzeug\__init__.py)
When you install
Flask-Uploads
from PyPI by e.g.pip install Flask-Uploads
you get an outdated version.In February 2020 there was a breaking change in
Werkzeug
- thus your error message.Unfortunately, the author of
Flask-Uploads
decided against releasing a new version for PyPI.As an alternative, you can use
Flask-Reuploaded
. This package works as a drop-in-replacement, so you do even do not have to change a single line of code.https://pypi.org/project/Flask-Reuploaded/
https://github.com/jugmac00/flask-reuploaded