【问题标题】:gunicorn command not found, but it's in my requirements.txt找不到 gunicorn 命令,但它在我的 requirements.txt 中
【发布时间】:2020-02-28 13:00:51
【问题描述】:

我正在 Heroku 上部署一个 Django 应用程序,该应用程序正在成功部署,但是当我想在提供的 http 链接上查看应用程序时出现以下错误。 gunicorn 在我的 requirements.txt 文件中。

2020-02-21T16:22:09.021935+00:00 heroku[web.1]: State changed from crashed to starting
2020-02-21T16:22:18.635625+00:00 heroku[web.1]: Starting process with command `gunicorn brendan_project.wsgi -- log file-`
2020-02-21T16:22:20.734759+00:00 heroku[web.1]: Process exited with status 127
2020-02-21T16:22:20.679520+00:00 app[web.1]: bash: gunicorn: command not found

这是我的requirements.txt 文件:

asgiref==3.2.3
astroid==2.3.3
certifi==2019.11.28
chardet==3.0.4
dj-database-url==0.5.0
Django==3.0.2
django-crispy-forms==1.8.1
django-fontawesome==1.0
django-heroku==0.3.1
django-mailjet==0.3.1
django-sendgrid==1.0.1
django-smtp-ssl==1.0
gunicorn==20.0.4
idna==2.8
isort==4.3.21
lazy-object-proxy==1.4.3
mailjet-rest==1.3.3
mccabe==0.6.1
psycopg2==2.8.4
pylint==2.4.4
pytz==2019.3
PyYAML==5.3
requests==2.22.0
six==1.14.0
sqlparse==0.3.0
typed-ast==1.4.1
urllib3==1.25.7
whitenoise==5.0.1

我还有PipfilePipfile.lock 文件。

【问题讨论】:

  • 你在使用 virtualenv/Docker 吗?
  • 你也有PipfilePipfile.lock吗?
  • 您是否也将 requirements.txt 文件推送到 Heroku?
  • @MarcSances 我正在使用虚拟环境
  • @Chris 我有 Pipfile 和 Pipfile.lock 文件

标签: python django linux heroku


【解决方案1】:

我还有PipfilePipfile.lock 文件

那是你的问题:你使用了两种不同的工具,它们在某种程度上做同样的事情。

如果您有PipfilePipfile.lock,Heroku 使用Pipenv 安装您的依赖项,您的requirements.txt 将被忽略。

在没有PipfilePipfile.lock 的情况下,Heroku 使用pip 安装来自requirements.txt 的依赖项。

选择一个工具并在任何地方使用它。如果您选择 Pipenv,请确保您的所有依赖项都反映在您的 PipfilePipfile.lock 中(例如,通过运行 pipenv install -r requirements.txt),删除您的 requirements.txt,然后重新部署。如果您想使用pip,请摆脱您的PipfilePipfile.lock

【讨论】:

    猜你喜欢
    • 2012-12-19
    • 2015-05-12
    • 2018-12-09
    • 2022-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-30
    • 2013-02-06
    相关资源
    最近更新 更多