[Answered ]-Django on Heroku: KeyError: 'collectstatic'

1👍

The problem was my own fault but not in the Django app but in my Heroku configuration.
Inside my Heroku environmental variables (Settings > Config Vars), I had set the DJANGO_SETTINGS_MODULE incorrectly to project.prod_settings.
However, my Django project was called pytorch_django so I had to set it to pytorch_django.prod_settings.

That’s what caused the error ModuleNotFoundError: No module named 'project'.
Changing DJANGO_SETTINGS_MODULE to the correct path solved the problem.

Leave a comment