Heroku应用程序错误(应用程序在本地运行正常)

2024-10-01 09:24:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我整天都在尝试部署这个应用程序(使用Flask和Plotly-Dash)。部署过程工作,应用程序在本地运行没有任何问题,但我总是得到一个应用程序错误,当我试图查看网页,无法修复它

(主要是这个:at=error code=H10 desc=“App crashed”method=GET path=“/”)。你知道吗

以下是回溯和错误:

2019-10-20T18:48:07.34022+00:00 app[web.1]: Traceback (most recent call last): 2019-10-20T18:48:07.340229+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 210, in run 2019-10-20T18:48:07.34048+00:00 app[web.1]: self.sleep() 2019-10-20T18:48:07.340483+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 360, in sleep 2019-10-20T18:48:07.340674+00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0) 2019-10-20T18:48:07.340678+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 245, in handle_chld 2019-10-20T18:48:07.340823+00:00 app[web.1]: self.reap_workers() 2019-10-20T18:48:07.340827+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 528, in reap_workers 2019-10-20T18:48:07.341032+00:00 app[web.1]: raise HaltServer(reason, self.APP_LOAD_ERROR) 2019-10-20T18:48:07.341077+00:00 app[web.1]: gunicorn.errors.HaltServer: 2019-10-20T18:48:07.34108+00:00 app[web.1]: 2019-10-20T18:48:07.341081+00:00 app[web.1]: During handling of the above exception, another exception occurred: 2019-10-20T18:48:07.341082+00:00 app[web.1]: 2019-10-20T18:48:07.341084+00:00 app[web.1]: Traceback (most recent call last): 2019-10-20T18:48:07.341087+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 11, in 2019-10-20T18:48:07.341187+00:00 app[web.1]: sys.exit(run()) 2019-10-20T18:48:07.341191+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 61, in run 2019-10-20T18:48:07.341332+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() 2019-10-20T18:48:07.341338+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py", line 223, in run 2019-10-20T18:48:07.341481+00:00 app[web.1]: super(Application, self).run() 2019-10-20T18:48:07.341485+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py", line 72, in run 2019-10-20T18:48:07.341594+00:00 app[web.1]: Arbiter(self).run() 2019-10-20T18:48:07.341596+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 232, in run 2019-10-20T18:48:07.341733+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status) 2019-10-20T18:48:07.341737+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 345, in halt 2019-10-20T18:48:07.341907+00:00 app[web.1]: self.stop() 2019-10-20T18:48:07.341912+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 393, in stop 2019-10-20T18:48:07.342087+00:00 app[web.1]: time.sleep(0.1) 2019-10-20T18:48:07.342103+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 245, in handle_chld 2019-10-20T18:48:07.342235+00:00 app[web.1]: self.reap_workers() 2019-10-20T18:48:07.34225+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 528, in reap_workers 2019-10-20T18:48:07.342455+00:00 app[web.1]: raise HaltServer(reason, self.APP_LOAD_ERROR) 2019-10-20T18:48:07.342497+00:00 app[web.1]: gunicorn.errors.HaltServer: 2019-10-20T18:48:07.398607+00:00 heroku[web.1]: Process exited with status 1 2019-10-20T18:48:07.340382+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=dash-app-iwas.herokuapp.com request_id=83c66979-c099-4f73-a736-ae8643738f23 fwd="178.4.195.229" dyno=web.1 connect=3ms service=4943ms status=503 bytes=0 protocol=https 2019-10-20T18:48:07.43426+00:00 heroku[web.1]: State changed from up to crashed 2019-10-20T18:48:12.50511+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=dash-app-iwas.herokuapp.com request_id=ab745857-ec0c-4cec-b2a4-b28f16deeb28 fwd="178.4.195.229" dyno=web.1 connect=5002ms service= status=503 bytes= protocol=https 2019-10-20T18:48:31+00:00 app[api]: Build started by user iwas.iwas@outlook.de 2019-10-20T18:49:18.55734+00:00 app[api]: Deploy 1c05a6c8 by user iwas.iwas@outlook.de 2019-10-20T18:49:18.55734+00:00 app[api]: Release v4 created by user iwas.iwas@outlook.de 2019-10-20T18:49:20.155422+00:00 heroku[web.1]: State changed from crashed to starting 2019-10-20T18:49:30.372836+00:00 heroku[web.1]: Starting process with command gunicorn -b :8496 app:app 2019-10-20T18:49:33.058813+00:00 app[web.1]: [2019-10-20 18:49:33 +0000] [4] [INFO] Starting gunicorn 19.9.0 2019-10-20T18:49:33.059689+00:00 app[web.1]: [2019-10-20 18:49:33 +0000] [4] [INFO] Listening at: http://0.0.0.0:8496 (4) 2019-10-20T18:49:33.059846+00:00 app[web.1]: [2019-10-20 18:49:33 +0000] [4] [INFO] Using worker: sync 2019-10-20T18:49:33.068014+00:00 app[web.1]: [2019-10-20 18:49:33 +0000] [10] [INFO] Booting worker with pid: 10

如果有人能帮我,我会很高兴的。我花了一整天的时间,却无法修好它

下面的答案解决了这个问题。你知道吗


Tags: runinpyselfappherokulibpackages
1条回答
网友
1楼 · 发布于 2024-10-01 09:24:42

您需要在Procfile中设置服务器而不是应用程序

在你的Procfile变化中

web: gunicorn app:app

web: gunicorn app:server

有关更多信息,请参阅官方仪表板指南 https://dash.plot.ly/deployment

相关问题 更多 >