我有一个flask应用程序,它使用subprocess
调用我的dockerized应用程序。在
@app.route('/detect', methods=['POST'])
def detect_file():
file = request.files['wireframe']
if file and allowed_file(file.filename):
filename = str(uuid.uuid4()) + getFileExtension(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'],
filename))
p = subprocess.Popen(["docker","run","-v","/home/ganaraj/contours/upload:/detect","-w",
"/detect","-it","--rm","opecv3", "./prediction",
filename ], stdout=subprocess.PIPE)
output, err = p.communicate()
return jsonify(result=output.rstrip())
return jsonify(error='Mismatch file type')
当我单独运行flask应用程序时python app.py
它工作得很好。我从dockerized应用程序得到一个结果。
当我直接使用gunicorn运行flask应用程序时gunicorn wsgi.py
它也能正常工作。在
当我通过gunicorn运行flask应用程序并使用supervisor继续运行时,应用程序启动-api正常工作,除了DOCKERIZED部分。 我猜这和权限有关,但我不知道我到底需要做什么来解决这个问题。在
这是我的参考资料。在
^{pr2}$我是否需要对整个工具链的任何部分进行更改,以使其正常工作?在
目前没有回答
相关问题 更多 >
编程相关推荐