I uploaded my Django project to Heroku and I get this error message on the browser as shown on the screenshot
But when I check the log on the admin I see this message below:
2019-05-14T21:26:26.138333+00:00 app[web.1]: bash: gunicorn: command not found
But gunicorn
is included in my requirements.txt
file:
dj-database-url==0.5.0
Django==2.2.1
django-heroku==0.3.1
gunicorn==19.9.0
psycopg2==2.8.2
pytz==2019.1
sqlparse==0.3.0
whitenoise==4.1.2
I also have a Pipfile
and Pipfile.lock
.
Why can't Heroku find gunicorn
?
Generally speaking, you should use either requirements.txt
or Pipfile
and Pipfile.lock
. They do roughly the same thing, but work with different tooling.
Pipfile
and Pipfile.lock
are a newer standard. If they are present, Heroku installs dependencies using Pipenv . In this case the requirements.txt
file is ignored.
You should either
Choose to use Pipenv.
Pipfile
and Pipfile.lock
, but run pipenv install -r requirements.txt
locally just to be sure.requirements.txt
with git rm requirements.txt
.git commit -m 'Switch from pip to Pipenv'
. Choose to use pip
.
Read your Pipfile
to see if there's anything in there you might need. This file does more than just list dependencies.
For example, your Pipfile
may specify a required Python version like python_version = '3.7'
in the [requires]
section. This can't be represented in requirements.txt
, so you'll need to create a runtime.txt
file to specify your Python version.
You might also want to create a second requirements file for development dependencies.
Delete the Pipfile
and Pipfile.lock
with git rm Pipfile Pipfile.lock
.
Commit, eg git commit -m 'Revert from Pipenv to pip
.
Push to Heroku.
I uploaded my Django project to Heroku and I get this error message on the browser as shown on the screenshot
But when I check the log on the admin I see this message below:
2019-05-14T21:26:26.138333+00:00 app[web.1]: bash: gunicorn: command not found
But gunicorn
is included in my requirements.txt
file:
dj-database-url==0.5.0
Django==2.2.1
django-heroku==0.3.1
gunicorn==19.9.0
psycopg2==2.8.2
pytz==2019.1
sqlparse==0.3.0
whitenoise==4.1.2
I also have a Pipfile
and Pipfile.lock
.
Why can't Heroku find gunicorn
?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.