I’m having some trouble deploying my Django application on Heroku using Gunicorn, and I could really use some assistance.
Here’s some background information about my project:
Project Name: weatherapp
Procfile
web: gunicorn weatherapp.wsgi:application --log-file -
wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'weatherapp.settings')
application = get_wsgi_application()
Error Message
Traceback (most recent call last): File "/app/.heroku/python/lib/python3.12/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker ... ModuleNotFoundError: No module named 'weatherapp.wsgi'
Relavent code in settings.py
WSGI_APPLICATION = 'content_aggregator.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
django_heroku.settings(locals())
MEDIA_URL = '/imgs/'
MEDIA_ROOT = BASE_DIR / 'imgs'
It seems like Gunicorn is unable to locate the weatherapp.wsgi module during the deployment process.
I’ve double-checked my project structure and everything seems to be in order. Could anyone please provide some guidance on what might be causing this issue and how I can resolve it?
Any help would be greatly appreciated. Thanks in advance!
Started the Gunicorn server with the command gunicorn weatherapp.wsgi:application –log-file -.
But no changes
Neel Oza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.