提问人:zzzzzyeonnn 提问时间:11/15/2023 更新时间:11/15/2023 访问量:22
使用 Flask 部署 Herocu 时出现 500 错误 [已关闭]
500 Error on Herocu Deployment with Flask [closed]
问:
我制作了一个基于 flask 的分发应用程序。顺便说一句,它适用于本地服务器,但是当您将其部署为Herroku时,您会遇到500错误问题。我该怎么办? 这是我的错误日志。
2023-11-15T08:29:12.868410+00:00 heroku[router]: at=info method=GET path="/" host=plant-drop-and-bug-prediction-b718394aa42b.herokuapp.com request_id=fb3c0c27-84ea-4c7d-9f7d-ed3e992fda46 fwd="175.203.55.188" dyno=web.1 connect=0ms service=4ms status=200 bytes=772 protocol=https
2023-11-15T08:29:13.398141+00:00 app[web.1]: 10.1.81.137 - - [15/Nov/2023:08:29:13 +0000] "GET /favicon.ico HTTP/1.1" 404 207 "https://plant-drop-and-bug-prediction-b718394aa42b.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
2023-11-15T08:29:13.398293+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=plant-drop-and-bug-prediction-b718394aa42b.herokuapp.com request_id=a7d947cc-1637-4370-a982-7e3124bd982e fwd="175.203.55.188" dyno=web.1 connect=0ms service=1ms status=404 bytes=368 protocol=https
2023-11-15T08:29:33.115366+00:00 app[web.1]: [2023-11-15 08:29:33,113] ERROR in app: Exception on / [POST]
2023-11-15T08:29:33.115386+00:00 app[web.1]: Traceback (most recent call last):
2023-11-15T08:29:33.115387+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
2023-11-15T08:29:33.115387+00:00 app[web.1]: response = self.full_dispatch_request()
2023-11-15T08:29:33.115387+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-15T08:29:33.115388+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
2023-11-15T08:29:33.115388+00:00 app[web.1]: rv = self.handle_user_exception(e)
2023-11-15T08:29:33.115388+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-15T08:29:33.115389+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
2023-11-15T08:29:33.115389+00:00 app[web.1]: rv = self.dispatch_request()
2023-11-15T08:29:33.115390+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^
2023-11-15T08:29:33.115390+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
2023-11-15T08:29:33.115390+00:00 app[web.1]: return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2023-11-15T08:29:33.115391+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-15T08:29:33.115391+00:00 app[web.1]: File "/app/app.py", line 31, in submit_file
2023-11-15T08:29:33.115391+00:00 app[web.1]: label = getPrediction(filename)
2023-11-15T08:29:33.115391+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^
2023-11-15T08:29:33.115392+00:00 app[web.1]: File "/app/main_preprocessing.py", line 16, in getPrediction
2023-11-15T08:29:33.115392+00:00 app[web.1]: my_model=load_model("model/model_2.h5")
2023-11-15T08:29:33.115392+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-15T08:29:33.115393+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/keras/src/saving/saving_api.py", line 238, in load_model
2023-11-15T08:29:33.115393+00:00 app[web.1]: return legacy_sm_saving_lib.load_model(
2023-11-15T08:29:33.115393+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-15T08:29:33.115393+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
2023-11-15T08:29:33.115393+00:00 app[web.1]: raise e.with_traceback(filtered_tb) from None
2023-11-15T08:29:33.115394+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/h5py/_hl/files.py", line 562, in __init__
2023-11-15T08:29:33.115394+00:00 app[web.1]: fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
2023-11-15T08:29:33.115394+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-15T08:29:33.115394+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/h5py/_hl/files.py", line 235, in make_fid
2023-11-15T08:29:33.115394+00:00 app[web.1]: fid = h5f.open(name, flags, fapl=fapl)
2023-11-15T08:29:33.115395+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-15T08:29:33.115395+00:00 app[web.1]: File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
2023-11-15T08:29:33.115395+00:00 app[web.1]: File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
2023-11-15T08:29:33.115395+00:00 app[web.1]: File "h5py/h5f.pyx", line 102, in h5py.h5f.open
2023-11-15T08:29:33.115396+00:00 app[web.1]: OSError: Unable to synchronously open file (file signature not found)
2023-11-15T08:29:33.116275+00:00 app[web.1]: 10.1.25.141 - - [15/Nov/2023:08:29:33 +0000] "POST / HTTP/1.1" 500 265 "https://plant-drop-and-bug-prediction-b718394aa42b.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
2023-11-15T08:29:33.116429+00:00 heroku[router]: at=info method=POST path="/" host=plant-drop-and-bug-prediction-b718394aa42b.herokuapp.com request_id=f85088a8-d739-4de2-b2a9-f715be2ce140 fwd="175.203.55.188" dyno=web.1 connect=0ms service=1373ms status=500 bytes=438 protocol=https
答: 暂无答案
评论
OSError: Unable to synchronously open file (file signature not found)
File "h5py/h5f.pyx"