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:

  1. 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.

  2. then configured heroku use (heroku multi buildpack) running following command:

    heroku buildpacks:set https://github.com/ddollar/heroku-buildpack-multi

  3. 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: enter image description here

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:

  1. cd /path/to/your/dir && git init

  2. heroku create myapp (start scratch)

  3. heroku config:add buildpack_url=https://github.com/ddollar/heroku-buildpack-multi.git --app myapp

  4. create .buildpacks follows:

    https://github.com/heroku/heroku-buildpack-python https://github.com/diogojc/heroku-buildpack-python-opencv-scipy#cedar14 
  5. git add . && git commit -m 'message' && git push heroku master


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -