Django部署到heroku:应用程序错误

时间:2020-04-24 14:40:33

标签: python django heroku

我将Django项目部署到了​​heroku。它已成功部署,但页面显示“应用程序错误”。在heroku错误日志中是这样的。

2020-04-24T05:34:09.500250+00:00 app[web.1]: [2020-04-24 05:34:09 +0000] [4] [INFO] Using worker: sync
2020-04-24T05:34:09.506988+00:00 app[web.1]: [2020-04-24 05:34:09 +0000] [10] [INFO] Booting worker with pid: 10
2020-04-24T05:34:09.532649+00:00 app[web.1]: [2020-04-24 05:34:09 +0000] [11] [INFO] Booting worker with pid: 11
2020-04-24T05:34:10.051702+00:00 heroku[web.1]: State changed from starting to up
2020-04-24T05:34:20.000000+00:00 app[api]: Build succeeded
2020-04-24T05:34:26.126726+00:00 app[web.1]: [2020-04-24 05:34:26 +0000] [4] [INFO] Shutting down: Master
2020-04-24T05:34:41.808971+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=dashboard-retail.herokuapp.com request_id=f5feaeba-075f-4dc7-a637-fe6b271f0d67 fwd="125.24.11.115" dyno=web.1 connect=1ms service=30003ms status=503 bytes=0 protocol=https
2020-04-24T05:34:42.096139+00:00 app[web.1]: [2020-04-24 05:34:42 +0000] [4] [CRITICAL] WORKER TIMEOUT (pid:10)

在Procfile中,我这样设置

web:gunicorn myWeb.wsgi --log文件-

请帮帮我。谢谢。

1 个答案:

答案 0 :(得分:0)

gunicorn似乎在错误的端口上侦听,而不是在等待哪个buildpack上侦听,因此会出现503错误。尝试将$PORT添加到您的Procfile

web: gunicorn myWeb.wsgi --log-file - --bind 0.0.0.0:$PORT