Heikki
Heikki

Reputation: 351

What is the propper way to debug gunicorn?

I am trying to deploy my very first Django applicatin on heroku. Gunicorn gives me this error: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

In this answer https://stackoverflow.com/a/55623889 command gunicorn app:application --preload -b 0.0.0.0:5000 is said to give detailed error message, but as its comments state it is not clear what words to replace with what. For instance somewhere I saw something similar called with <name of my app>.wsgi. To make matter worse name of my Django app in local is different from the one on Heroku.

Also it is not clear to me should this be called strait from terminal (within virtual env) or should I be using some sort of gunicorn CLI.

So what is the actual propper way to figure out what is failing gunicorn?

Upvotes: 0

Views: 796

Answers (1)

eManuel
eManuel

Reputation: 23

I've faced similar issues in the past. I hope this might help:

  1. Make sure gunicorn is installed in your activated virtual environment project by running pip freeze in the terminal to verify it's installation. If it is not listed, in the activated virtual environment, run pip install gunicorn or else if you are using pipenv, run pipenv install gunicorn. Don't forget to update the requirements.txt file by running pip freeze > requirements.txt

  2. In the Procfile which is within the project_directory type the syntax:

web: gunicorn your_django_project_name.wsgi --log-file -

N.B: There should be a space between;

  1. The --log-file and the - next to it.
  2. web: and the gunicorn part of the code.

Finally add, commit and push the changes to the heroku server.

Upvotes: 1

Related Questions