首页 > 解决方案 > 烧瓶和heroku

问题描述

我开发了一个烧瓶应用程序并打算将其部署在 Heroku 上,但我一直面临问题。API 在邮递员和本地主机上运行良好,但是当我部署它时,应用程序崩溃并出现错误代码 H10。请问有什么建议吗?

API 在 OpenCV TensorFlow-CPU 上(我猜是因为 Heroku 不支持 GPU)Keras 和 dlib。我的要求清单:

absl-py==0.11.0
astunparse==1.6.3
cached-property==1.5.2
cachetools==4.2.1
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
Flask==1.1.2
flatbuffers==1.12
gast==0.3.3
google-auth==1.27.0
google-auth-oauthlib==0.4.2
google-pasta==0.2.0
grpcio==1.32.0
gunicorn==20.0.4
h5py==2.10.0
idna==2.10
importlib-metadata==3.4.0
itsdangerous==1.1.0
Jinja2==2.11.3
Keras==2.4.3
Keras-Preprocessing==1.1.2
Markdown==3.3.3
MarkupSafe==1.1.1
numpy==1.19.5
oauthlib==3.1.0
opencv-python==4.5.1.48
opt-einsum==3.3.0
protobuf==3.15.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
PyYAML==5.4.1
requests==2.25.1
requests-oauthlib==1.3.0
rsa==4.7.1
scipy==1.5.4
six==1.15.0
tensorboard==2.4.1
tensorboard-plugin-wit==1.8.0
tensorflow-cpu==2.4.1
tensorflow-estimator==2.4.0
termcolor==1.1.0
typing-extensions==3.7.4.3
urllib3==1.26.3
Werkzeug==1.0.1
wrapt==1.12.1
zipp==3.4.0

标签: pythonheroku

解决方案


heroku 中的某些依赖项存在一些兼容性问题,您可以根据收到的错误消息尝试降级一些。当我尝试使用您的要求列表时,我得到了:-

remote:        Successfully built termcolor wrapt
remote:        ERROR: tensorflow-cpu 2.4.1 has requirement wheel~=0.35, but you'll 
have wheel 0.34.2 which is incompatible.
remote:        Installing collected packages: six, absl-py, astunparse, cached- 
property, cachetools, certifi, chardet, click, Werkzeug, itsdangerous, MarkupSafe, 
Jinja2, Flask, flatbuffers, gast, pyasn1, rsa, pyasn1-modules, google-auth, oauthlib, 
idna, urllib3, requests, requests-oauthlib, google-auth-oauthlib, google-pasta, 
grpcio, gunicorn, numpy, h5py, typing-extensions, zipp, importlib-metadata, PyYAML, 
scipy, Keras, Keras-Preprocessing, Markdown, opencv-python, opt-einsum, protobuf, 
tensorboard-plugin-wit, tensorboard, tensorflow-estimator, termcolor, wrapt, 
tensorflow-cpu

在 heroku cli 日志中 ( https://devcenter.heroku.com/articles/logging )

当我尝试将其更改为 tensorflow-cpu 2.4.0 时它可以工作,但这也取决于您的应用程序是否会在更改后运行然后它可以工作,但您的应用程序可能无法工作,因此您必须修改依赖项的版本以检查它是否兼容heroku 和你的都不会影响你的应用程序的工作。

参考 :

https://github.com/Anirudh-thakur/FlaskNoteDetector#how-to-deploy-on-heroku-

https://flassger-banknote.herokuapp.com/apidocs/


推荐阅读