Flask App适用于localhost但Heroku上的错误500

时间:2018-06-13 11:40:43

标签: python heroku flask

我为视频流创建了一个烧瓶应用程序。它在localhost上运行正常,但是为特定请求提供了内部服务器错误。

app.py

@app.route('/video_feed')
def video_feed():
"""Video streaming route. Put this in the src attribute of an img tag."""
   return Response(gen(Camera()),
                mimetype='multipart/x-mixed-replace; boundary=frame')

的index.html

<img src="{{ url_for('video_feed') }}">

除此之外,一切正常。它说未找到客户端错误500 video_feed。我不知道问题出在哪里,因为这在localhost上工作正常。

我不知道这是否有帮助:

if __name__ == '__main__':
   app.run(host='0.0.0.0', debug=True, threaded=True)

错误日志

2018-06-13T11:50:08.542211+00:00 app[web.1]: Camera warming up ...
2018-06-13T11:50:09.543131+00:00 app[web.1]: OpenCV(3.4.1) Error: Unknown error code -10 (Raw image encoder error: Empty JPEG image (DNL not supported)) in throwOnEror, file /io/opencv/modules/imgcodecs/src/grfmt_base.cpp, line 145
2018-06-13T11:50:09.545191+00:00 app[web.1]: [2018-06-13 11:50:09 +0000] [8] [ERROR] Error handling request /video_feed
2018-06-13T11:50:09.545195+00:00 app[web.1]: Traceback (most recent call last):
2018-06-13T11:50:09.545200+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 135, in handle
2018-06-13T11:50:09.545203+00:00 app[web.1]: self.handle_request(listener, req, client, addr)
2018-06-13T11:50:09.545204+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 181, in handle_request
2018-06-13T11:50:09.545206+00:00 app[web.1]: for item in respiter:
2018-06-13T11:50:09.545208+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/werkzeug/wsgi.py", line 704, in __next__
2018-06-13T11:50:09.545209+00:00 app[web.1]: return self._next()
2018-06-13T11:50:09.545211+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
2018-06-13T11:50:09.545212+00:00 app[web.1]: for item in iterable:
2018-06-13T11:50:09.545214+00:00 app[web.1]: File "/app/app.py", line 18, in gen
2018-06-13T11:50:09.545216+00:00 app[web.1]: frame = camera.get_frame()
2018-06-13T11:50:09.545218+00:00 app[web.1]: File "/app/morse_camera.py", line 22, in get_frame
2018-06-13T11:50:09.545219+00:00 app[web.1]: ret, jpeg = cv2.imencode('.jpg', image)
2018-06-13T11:50:09.545221+00:00 app[web.1]: cv2.error: OpenCV(3.4.1) /io/opencv/modules/imgcodecs/src/grfmt_base.cpp:145: error: (-10) Raw image encoder error: Empty JPEG image (DNL not supported) in function throwOnEror
2018-06-13T11:50:09.545223+00:00 app[web.1]: 
2018-06-13T11:50:09.545462+00:00 app[web.1]: 10.67.237.54 - - [13/Jun/2018:11:50:09 +0000] "GET /video_feed HTTP/1.1" 500 - "-" "-"
2018-06-13T11:50:09.545728+00:00 app[web.1]: Camera disabled and all output windows closed

0 个答案:

没有答案