问题
I successfully install gunicorn:
remote: -----> Removing .DS_Store files
remote: -----> Python app detected
remote: -----> Installing dependencies with pip
remote: Collecting gunicorn==19.0.0 (from -r requirements.txt (line 1))
remote: Downloading gunicorn-19.0.0.tar.gz (382kB)
remote: Installing collected packages: gunicorn
remote: Running setup.py install for gunicorn
remote: Successfully installed gunicorn-19.0.0
My Procfile:
web: gunicorn myapp:app --log-file=-
But the app crashes when deployed:
bash: gunicorn: command not found
I tried adding the heroku python buildpack, but no luck. If I roll back to a previous commit (where requirements.txt
and Procile
are both unchanged), it works:
heroku/web.1: Starting process with command `gunicorn myapp:app --log-file=-`
app/web.1: 2015-10-08 17:04:18 [3] [INFO] Listening at: http://0.0.0.0:51854 (3)
回答1:
Make sure gunicorn
is in your requirements.txt
回答2:
The issue seemed to fix itself after uninstalling all requirements remotely, and reinstalling them.
回答3:
If you have both requirements.txt and Pipfile in the project root, then I would recommend to delete the Pipfile and have all your requirements listed in requirements.txt file (including gunicorn).
It will then show: "Installing requirements from pip", and all of your requirements listed in requirements.txt will be installed.
回答4:
After checking that gunicorn
is in requirements.txt
run:
pip install -r requirements.txt
My output contained several Requirement already satisfied: ...
but gunicorn
wasn't installed:
Collecting gunicorn (from -r requirements.txt (line 2))
Using cached ...
Installing collected packages: gunicorn
Successfully installed gunicorn-19.9.0
回答5:
I was missing the heroku/python buildpack so I went to the dashboard and:
Settings -> Add buildpack -> heroku/python
来源:https://stackoverflow.com/questions/33021874/heroku-gunicorn-not-working-bash-gunicorn-command-not-found