【问题标题】:Heroku application error logs, cannot run heroku openHeroku 应用程序错误日志,无法运行 heroku open
【发布时间】:2021-08-28 03:23:14
【问题描述】:

打开 Heroku 运行时出现错误

应用程序错误

应用程序发生错误,您的页面无法访问 服务。如果您是应用程序所有者,请查看您的日志以获取详细信息。 您可以在 Heroku CLI 中使用以下命令完成此操作

heroku logs --tail

可能是什么问题? DJANGO_SECRET_KEY 的问题会导致这样的问题吗?

这是我的日志

2021-06-11T05:06:11.906892+00:00 app[api]: Initial release by user a
2021-06-11T05:06:11.906892+00:00 app[api]: Release v1 created by user a
2021-06-11T05:06:12.046032+00:00 app[api]: Enable Logplex by user a
2021-06-11T05:06:12.046032+00:00 app[api]: Release v2 created by user a
2021-06-11T06:24:58.000000+00:00 app[api]: Build started by user
2021-06-11T06:25:45.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/67a0bf8e-56f4-41bd-b9de-b02c9ca20f13/activity/builds/b4469f36-8883-468b-95a2-aadaa03ff662
2021-06-11T06:36:08.000000+00:00 app[api]: Build started by user a
2021-06-11T06:36:39.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/67a0bf8e-56f4-41bd-b9de-b02c9ca20f13/activity/builds/254007fa-69b7-45d7-9490-5bd0643ec3cf
2021-06-11T06:37:40.559478+00:00 app[api]: Set DISABLE_COLLECTSTATIC config vars by user a
2021-06-11T06:37:40.559478+00:00 app[api]: Release v3 created by user a
2021-06-11T06:38:00.000000+00:00 app[api]: Build started by user a
2021-06-11T06:38:41.947391+00:00 app[api]: Running release v4 commands by user a
2021-06-11T06:38:41.947391+00:00 app[api]: Attach DATABASE (@ref:postgresql-fitted-13790) by user a
2021-06-11T06:38:41.960986+00:00 app[api]: @ref:postgresql-fitted-13790 completed provisioning, setting DATABASE_URL. by user a
2021-06-11T06:38:41.960986+00:00 app[api]: Release v5 created by user a
2021-06-11T06:38:42.248836+00:00 app[api]: Release v6 created by user a
2021-06-11T06:38:42.248836+00:00 app[api]: Deploy 631aaa14 by user a
2021-06-11T06:38:42.263855+00:00 app[api]: Scaled to web@1:Free by user a
2021-06-11T06:38:47.377590+00:00 heroku[web.1]: Starting process with command `: gunicorn taskmate.wsgi`
2021-06-11T06:38:49.701398+00:00 heroku[web.1]: Process exited with status 0
2021-06-11T06:38:49.759979+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-11T06:38:49.786811+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-11T06:38:53.000000+00:00 app[api]: Build succeeded
2021-06-11T06:38:54.704761+00:00 heroku[web.1]: Starting process with command `: gunicorn taskmate.wsgi`
2021-06-11T06:38:56.938703+00:00 heroku[web.1]: Process exited with status 0
2021-06-11T06:38:57.009000+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-11T06:39:21.946361+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=taskmatealex.herokuapp.com request_id=03769758-3201-4ace-84d7-eff640f19e64 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https
2021-06-11T06:39:22.615862+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=taskmatealex.herokuapp.com request_id=a3bb074c-e730-47e5-a8d8-3a56a654d536 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https
2021-06-11T06:44:11.320345+00:00 app[api]: Set DJANGO_SECRET_KEY config vars by user a
2021-06-11T06:44:11.320345+00:00 app[api]: Release v7 created by user a
2021-06-11T06:44:11.681506+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-11T06:44:16.640737+00:00 heroku[web.1]: Starting process with command `: gunicorn taskmate.wsgi`
2021-06-11T06:44:20.185781+00:00 heroku[web.1]: Process exited with status 0
2021-06-11T06:44:20.627488+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-11T06:44:45.899230+00:00 app[api]: Set DJANGO_DEBUG config vars by user a
2021-06-11T06:44:45.899230+00:00 app[api]: Release v8 created by user a
2021-06-11T06:44:46.186652+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-11T06:44:51.580724+00:00 heroku[web.1]: Starting process with command `: gunicorn taskmate.wsgi`
2021-06-11T06:44:53.930104+00:00 heroku[web.1]: Process exited with status 0
2021-06-11T06:44:53.996520+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-11T06:45:49.132605+00:00 app[api]: Set DJANGO_ALLOWED_HOSTS config vars by user a
2021-06-11T06:45:49.132605+00:00 app[api]: Release v9 created by user a
2021-06-11T06:45:50.149885+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-11T06:45:55.131936+00:00 heroku[web.1]: Starting process with command `: gunicorn taskmate.wsgi`
2021-06-11T06:45:57.900136+00:00 heroku[web.1]: Process exited with status 0
2021-06-11T06:45:57.975963+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-11T06:46:16.613566+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=taskmatealex.herokuapp.com request_id=75595574-8bfd-4851-92a7-667346862310 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https
2021-06-11T06:46:17.030878+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=taskmatealex.herokuapp.com request_id=88926793-6033-41cb-8b5b-5d80d227ec44 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https
2021-06-11T06:46:48.270024+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=taskmatealex.herokuapp.com request_id=caba852e-9548-4020-a230-d59a94770034 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https
2021-06-11T06:46:48.896248+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=taskmatealex.herokuapp.com request_id=fa079ddf-ba6d-4b0a-8bb7-44171a2e89f0 fwd="103.70.154.90" dyno= connect= service= status=503 bytes= protocol=https
2021-06-11T06:52:16.814200+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-11T06:52:22.174366+00:00 heroku[web.1]: Starting process with command `: gunicorn taskmate.wsgi`
2021-06-11T06:52:26.162459+00:00 heroku[web.1]: Process exited with status 0
2021-06-11T06:52:26.256358+00:00 heroku[web.1]: State changed from starting to crashed

【问题讨论】:

  • 直接执行你的 django 项目,而不用把它隐藏在 gunicorn WSGI 后面。 Gunicorn 不会重定向错误日志。 Gunicorn 也不兼容所有 django 项目。
  • 你能告诉我怎么做吗?
  • 你是如何在本地执行你的项目的?你可能没有使用 gunicorn 来做到这一点。
  • 在这个项目示例中:github.com/ericmjl/minimal-flask-example python app.py 执行烧瓶应用程序而不将其隐藏在 gunicorn 后面。 web: gunicorn app:app 执行文件app.py,其中定义了对象app,并将其隐藏在WSGI 后面。请注意,在后一种情况下 app.py if __name__ == "__main__":returns False 因此最后一行不会执行。
  • 使用 gunicorn 应该没有问题。如果需要,可以添加 --log-file blah.txt 来保存日志。然后使用 heroku bash 查看文件内容。无论如何,wsgi.py 文件中有什么? wsgi 中指定的设置文件是否存在?.. 还是您的设置设置与 Django 的默认方法不同?

标签: python django heroku application-error


【解决方案1】:

我的 Procfile 不正确 我把它从

web: gunicorn taskmate.wsgi

web: gunicorn taskmate.wsgi:application --log-file - --log-level debug
python manage.py collectstatic --noinput
manage.py migrate

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-19
    • 2013-05-05
    • 2019-04-16
    • 2014-11-03
    • 2020-11-06
    • 1970-01-01
    • 2016-10-06
    相关资源
    最近更新 更多