Heroku Flask Gunicorn Command not found

谁说我不能喝 提交于 2021-01-28 16:42:58

问题


Trying to deploy my flask app to Heroku but keep running into this error:

2020-06-18T04:13:43.162139+00:00 heroku[web.1]: State changed from crashed to starting 2020-06-18T04:13:47.317872+00:00 heroku[web.1]: Starting process with command gunicorn learning_flashcards:app 2020-06-18T04:13:49.836638+00:00 heroku[web.1]: Process exited with status 127 2020-06-18T04:13:49.884998+00:00 heroku[web.1]: State changed from starting to crashed 2020-06-18T04:13:49.767236+00:00 app[web.1]: bash: gunicorn: command not found

I've checked a few other solutions on here (like this one: Heroku can't find gunicorn command) and have followed their advice, including:

  • Putting gunicorn in the requirements.txt file and re-running it
  • pip installing gunicorn
  • Double-checking git and git push heroku master are up to date

Also, running Heroku local shows this:

12:23:12 AM web.1 | [2020-06-18 00:23:12 -0400] [16504] [INFO] Starting gunicorn 20.0.4 12:23:12 AM web.1 | [2020-06-18 00:23:12 -0400] [16504] [INFO] Listening at: http://0.0.0.0:5000 (16504) 12:23:12 AM web.1 | [2020-06-18 00:23:12 -0400] [16504] [INFO] Using worker: sync 12:23:12 AM web.1 | [2020-06-18 00:23:12 -0400] [16507] [INFO] Booting worker with pid: 16507

So gunicorn seems to be running ok.

I'm wondering if I'm not writing the command in the procfile correctly? Have also tried fiddling with this but no luck.

Here is my root directory:

.
├── Procfile
├── __pycache__
├── config.py
├── learning_flashcards
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-36.pyc
│   │   ├── app.cpython-36.pyc
│   │   └── views.cpython-36.pyc
│   ├── app.py
│   ├── static
│   │   └── style.css
│   ├── templates
│   └── views.py
├── manage.py
├── requirements
│   ├── common.txt
│   ├── dev.txt
│   ├── requirements.txt
│   └── runtime.txt
├── setup.py
├── tests
└── venv

And learning_flashcards/app.py:

from flask import Flask

app = Flask(__name__)


@app.route('/')
def learning_flashcards():
return "Hello World!"

if __name__ == '__main__':
    app.run()

来源:https://stackoverflow.com/questions/62442436/heroku-flask-gunicorn-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!