How to see full Heroku stacktrace in logs?

Viewed 209

When I deploy my Django app to Heroku, in the console (heroku logs --tail -a george-paintings) I see an error:

2021-04-15T15:14:42.109272+00:00 app[web.1]: Error: No application module specified.
2021-04-15T15:14:42.161597+00:00 heroku[web.1]: Process exited with status 1
2021-04-15T15:14:42.290903+00:00 heroku[web.1]: State changed from starting to crashed

But I can't figure out what particular went wrong. My Procfile looks like this

web: gunicorn --pythonpath application.george_paintings.george_paintings.wsgi --log-file - --log-level debug

Where can I find more info about my error?

1 Answers

I suspect there's nothing more to see. A good first step would be to try running heroku local to see if you are having the same problem on your development machine. This will use your Procfile whereas if you are running via python manage.py migrate or similar your Procfile will not be used.

The error gives a good hint, though:

app[web.1]: Error: No application module specified.

Gunicorn expects an application module name as a command-line argument. I suspect you intend application.george_paintings.george_paintings.wsgi to be interpreted as your application module, but it's getting swallowed up as an argument to --pythonpath:

gunicorn --pythonpath application.george_paintings.george_paintings.wsgi  #...

You shouldn't need to explicitly provide a PYTHONPATH. Try removing that argument from your Procfile entirely:

gunicorn application.george_paintings.george_paintings.wsgi --log-file - --log-level debug

If this works locally with heroku local, commit the change and redeploy.

If not, take a look at your directory structure. application.george_paintings.george_paintings.wsgi is a bit of a weird module name for a Django project. Usually you'd just need something like george_paintings.wsgi (indicating that Gunicorn should use the Python module it finds at george_paintings/wsgi.py as its entry point).

Related