问题描述
我正在Heroku上部署Django应用程序,该应用程序已成功部署,但是当我想在提供的http链接上查看该应用程序时出现以下错误. gunicorn
在我的 requirements.txt
文件中.
I am deploying a Django app on Heroku , which is successfully deploying, but I am getting the following error when I want to view the app on the provided http link. gunicorn
is in my requirements.txt
file.
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
我还有 Pipfile
和 Pipfile.lock
文件.
推荐答案
那是你的问题:您正在使用两个不同的工具,部分地,它们执行相同的操作.
That's your problem: you're using two different tools that, partly, do the same thing.
如果您有 Pipfile
和 Pipfile.lock
,Heroku使用 Pipenv 安装您的依赖项,您的 requirements.txt
将被忽略.
If you have a Pipfile
and Pipfile.lock
, Heroku uses Pipenv to install your dependencies, and your requirements.txt
will be ignored.
在没有 Pipfile
和 Pipfile.lock
的情况下,Heroku使用 pip
从 requirements.txt 安装依赖项.代码>.
In the absence of a Pipfile
and Pipfile.lock
, Heroku uses pip
to install dependencies from requirements.txt
.
选择一个工具并在任何地方使用它.如果选择Pipenv,请确保所有依赖项都反映在 Pipfile
和 Pipfile.lock
中(例如,通过运行 pipenv install -r requirements.txt 代码>),删除您的
requirements.txt
,然后重新部署.如果要使用 pip
,请摆脱 Pipfile
和 Pipfile.lock
.
Pick a single tool and use it everywhere. If you choose Pipenv, make sure all of your dependencies are reflected in your Pipfile
and Pipfile.lock
(e.g. by running pipenv install -r requirements.txt
), delete your requirements.txt
, and redeploy. If you want to use pip
, get rid of your Pipfile
and Pipfile.lock
.
这篇关于找不到gunicorn命令,但这在我的requirements.txt中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!