I'm having trouble to deploy my flask application on heroku, my directory tree is looking like down below:
├── app
│ ├── errors.py
│ ├── forms.py
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── models.py
│ ├── __pycache__
│ ├── routes.py
│ ├── static
│ ├── storage.db
│ └── templates
├── migrations
├── Procfile
├── README.md
├── requirements.txt
├── run.py
└── runtime.txt
$ cat runtime
python-3.8.5
$ cat Procfile
web: gunicorn: app:app
I'm quite confuse on the configuration of Procfile, should I call run.py (The archive I use to call locally with "flask run") or app (The folder where init.py calls flask instance and sql_alchemy instance)?
Anyway, both configurations returned the error below:
$ heroku logs --tail
heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `gunicorn: app:app`
app[web.1]: bash: gunicorn:: command not found
heroku[web.1]: Process exited with status 127
heroku[web.1]: State changed from starting to crashed
gunicorn is already configured at requirements.py
Assuming your run.py
is the entry point of your app and you have named your flask instance as app
, your Procfile should look like:
web: gunicorn run:app
It is because in your Procfile the first argument must be the name of your main file or entry file from where you are running your website and the second is the name of your flask instance itself. Atleast it is with the case of gunicorn and heroku.