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()