[英]Python Flask (deployed on Heroku): ImportError: cannot import name 'secure_filename' from 'werkzeug' when deploying on Heroku
When deploying a flask application on heroku im getting the error above.在 heroku 上部署 flask 应用程序时,我收到上述错误。 The problem on heroku is that it installs dependencies and Iam not able to overwrite them then, or?
heroku 的问题是它安装了依赖项,然后我无法覆盖它们,或者? On my local server i just went to flask_uploads.py and change the imports to:
在我的本地服务器上,我只是去了 flask_uploads.py 并将导入更改为:
from werkzeug.utils import secure_filename
from werkzeug.datastructures import FileStorage
and this works fine.这很好用。
but when deploying the flask app to heroku, how can I change the the content of flask_uploads.py after it had been installed?但是在将 flask 应用程序部署到 heroku 时,安装后如何更改 flask_uploads.py 的内容?
flask-uploads
is no longer properly maintained and has not released a fix to the updated Werkzeug API change, thus you see this error. flask-uploads
不再正确维护,并且尚未发布对更新的 Werkzeug API 更改的修复,因此您会看到此错误。
Just swap flask-uploads
with flask-reuoloaded
in your dependency list, eg requirements.txt or similar.只需在依赖项列表中将
flask-uploads
与flask-reuoloaded
交换,例如 requirements.txt 或类似文件。 You don't have to change your imports!你不必改变你的进口!
See https://github.com/jugmac00/flask-reuploaded见https://github.com/jugmac00/flask-reuploaded
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.