I was trying to use flask-uploads module but I found in the thread:
That I should go with flask-reuploaded module to fix the error:
import name 'secure_filename' from 'werkzeug' (c:\users\gabri\desktop\shop\venv\lib\site-packages\werkzeug\__init__.py)
It says in the thread that I don't have to change a line of code but I dont know how to import the module properly, because when I try
from flask_uploads import UploadSet
I get
No module named 'flask_uploads'
and if I try any variation of from flask-reuploaded import UploadSet
It cannot find the proper library to import
I didn't find anything about it in documentation can you please help?
The package for
Flask-Uploads
on PyPi is broken since February 2020 whenWerkzeug
changed its API, thus the error message you see.You can either install
Flask-Uploads
directly from GitHub or instead ofFlask-Uploads
installFlask-Reuploaded
which is a compatible drop-in replacement.https://pypi.org/project/Flask-Reuploaded/
As of Oct 5th, 2020, there is no "get started" guide on
Flask-Reuploaded
s README page, that's correct.As stated in the https://flask-reuploaded.readthedocs.io/en/latest/ and as you tried already, you just have to install
Flask-Reuploaded
and then e.g. do afrom flask_uploads import Uploadset
.Please note it is
from flask_uploads...
notfrom flask_reuploaded
. That is done on purpose to be 100% compatible withFlask-Uploads
.When you experience an error like
No module named 'flask_uploads'
this strongly indicates one of two possible problems:Flask-Reuploaded
Flask
Please make sure to install both packages into the same
virtual environment
.To prove it... do a
pip freeze
- for me that would look like the following...That all said - I will update the README section of
Flask-Reuploaded
as soon as possible.Update, January 18th, 2021
I have updated the README of
Flask-Reuploaded
with more clear information how to get a project started.https://github.com/jugmac00/flask-reuploaded/blob/master/README.rst