【问题标题】:Heroku Django webapp getting error logs say gunicorn command not found but it is thereHeroku Django webapp收到错误日志说未找到gunicorn命令但它在那里
【发布时间】:2018-08-27 13:54:58
【问题描述】:

我正在尝试使用 postgresql 在 heroku 上运行 django 应用程序,但我得到了 当我转到我的应用程序网址时,我会检查 heroku 日志 --tail 并查看

2018-08-27T10:37:19.086599+00:00 heroku[web.1]: State changed from starting to crashed 2018-08-27T10:37:19.070449+00:00 heroku[web.1]: Process exited with status 127 2018-08-27T10:37:18.986150+00:00 app[web.1]: bash: gunicorn: command not found 我有一个带有 gunicorn 的 requirements.txt,安装了 heroku python buildpack

我尝试使用远程安装 gunicorn heroku run pip install -r requirements.txt

但我明白了 › Error: remote requirements.txt not found in git remotes

【问题讨论】:

  • 检查requirements.txt是否像manage.py一样在根文件夹中。
  • 还要检查您是否将 gunicorn 添加到已安装的应用程序中。我曾经犯过这个错误。
  • 它在根 floydya 中,我不知道这是必要的迪士尼
  • 是否以正确的方式将“gunicorn”添加到 settings.py 安装的应用程序中?
  • 好的,然后我也遇到了需要允许 heroku 允许主机的错误,但之后它终于起作用了!

标签: python django heroku


【解决方案1】:

我也在使用 Django,在我将更新推送到 Heroku 几分钟后,在 heroku logs --tail 中看到了同样的错误。在推送到 Heroku 之前,一切正常。

为了解决这个问题,首先我确保以下之前工作的文件在推送时保持不变:

  • requirements.txt
  • Aptfile
  • 过程文件
  • 运行时
  • wsgi

由于这些文件保持不变,我得出的结论是某些超出我知识范围的问题导致了问题。所以我在 Heroku 中进入了应用程序的 Activity Feed,找到了我知道可以运行的版本并点击了 Roll back to here 链接。

当这不起作用时,根据另一位用户的推荐(我现在似乎找不到他的评论),我从 requirements.txt 中删除了所有包,然后将其推送到 Heroku,以便所有包都可以在应用程序中卸载。然后我将所有包添加回requirements.txt 并将其推送到 Heroku。现在它起作用了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-29
    • 2021-01-06
    • 1970-01-01
    • 2015-05-12
    • 1970-01-01
    • 2018-12-09
    • 2021-07-12
    相关资源
    最近更新 更多