简体   繁体   English

Flask 和 heroku

[英]Flask and heroku

I have developed a flask app and intending to deploy it on Heroku but I have been facing problems.我开发了一个 flask 应用程序并打算将其部署在 Heroku 上,但我一直面临问题。 the API works fine on postman and localhost but when I deploy it the application crashes with an error code of H10.any suggestions plz? API 在 postman 和 localhost 上运行良好,但是当我部署它时,应用程序崩溃并显示错误代码为 H10。请问有什么建议吗?

the API is on OpenCV TensorFlow-CPU (coz Heroku doesn't support GPU I guess) Keras and dlib. the API is on OpenCV TensorFlow-CPU (coz Heroku doesn't support GPU I guess) Keras and dlib. LIST of my requirements:我的要求清单:

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

There are some compatibility issues with some dependencies in heroku and you can try downgrading a few depending on the error message you get. heroku 中的某些依赖项存在一些兼容性问题,您可以根据收到的错误消息尝试降级一些。 When I tried with you requirement list I got:-当我尝试使用您的要求列表时,我得到了:-

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

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

when I tried changed it to tensorflow-cpu 2.4.0 then it worked but it also depends whether you application will run after changing then it works but your application might not work so you will have to modify versions of dependencies to check if it is compatible with both heroku and your doesnt affect the working of your applications.当我尝试将其更改为 tensorflow-cpu 2.4.0 时,它可以工作,但这也取决于您的应用程序是否会在更改后运行,然后它可以工作,但您的应用程序可能无法工作,因此您必须修改依赖项的版本以检查它是否兼容与 heroku 和你不影响你的应用程序的工作。

References:参考:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM