Python web application with OpenCV in Heroku -
i building web application uses opencv in back-end. have built application on ubuntu (and tried on windows, too) , works fine. currently, trying configure opencv work on heroku. opencv not possible loaded using pip, read using heroku buildpacks provide customization server environment.
the following attempt test 2 of opencv buildpacks:
i build simple web server flask tries import opencv:
#hello.py import os flask import flask app = flask(__name__) @app.route("/") def hello(): text = '' try: import cv2 text = 'success' except: text = 'fail' pass return text + ' load opencv' if __name__ == "__main__": port = int(os.environ.get("port", 5000)) app.run(host='0.0.0.0', port=port)the above code should return either success or fail in loading opencv.
then configured heroku use (heroku multi buildpack) running following command:
heroku buildpacks:set https://github.com/ddollar/heroku-buildpack-multi
in .buildpacks file (that required multi buildpack) put https://github.com/heroku/heroku-buildpack-python , https://github.com/slobdell/heroku-buildpack-python-opencv-scipy buildpacks.
the first 1 compiling python application , installing other modules (e.g., flask) through
pip.second buildpack 1 supposed load opencv.
after all, whole application did not work!
i got (application error) page in heroku following screenshot: 
i tried use other buildpack (https://github.com/diogojc/heroku-buildpack-python-opencv-scipy) got same result.
my questions are:
wrong in steps did?
how should call (or use) opencv within application in heroku?
should use import statement or other commands?
i install doing follows:
cd /path/to/your/dir && git initheroku create myapp(start scratch)heroku config:add buildpack_url=https://github.com/ddollar/heroku-buildpack-multi.git --app myappcreate
.buildpacksfollows:https://github.com/heroku/heroku-buildpack-python https://github.com/diogojc/heroku-buildpack-python-opencv-scipy#cedar14git add . && git commit -m 'message' && git push heroku master
Comments
Post a Comment