I cannot seem to deploy my Django application through gunicorn
. Here is my Procfile
:
web: gunicorn config.wsgi:application
My wsgi file is not located under the project, but under a config folder instead ./config/wsgi.py
:
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
application = get_wsgi_application()
application = DjangoWhiteNoise(application)
I'm using the heroku local
tool to try to test this and I am running into this error:
$heroku local
forego | starting web.1 on port 5000
web.1 | [2015-11-22 10:05:29 -0800] [32081] [INFO] Starting gunicorn 19.3.0
web.1 | [2015-11-22 10:05:29 -0800] [32081] [INFO] Listening at: http://0.0.0.0:5000 (32081)
web.1 | [2015-11-22 10:05:29 -0800] [32081] [INFO] Using worker: sync
web.1 | [2015-11-22 10:05:29 -0800] [32084] [INFO] Booting worker with pid: 32084
web.1 | [2015-11-22 10:05:29 -0800] [32084] [ERROR] Exception in worker process:
web.1 | __import__(module)
web.1 | hon2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
web.1 | [2015-11-22 10:05:29 -0800] [32084] [INFO] Worker exiting (pid: 32084)
web.1 | [2015-11-22 10:05:29 -0800] [32081] [INFO] Shutting down: Master
web.1 | [2015-11-22 10:05:29 -0800] [32081] [INFO] Reason: Worker failed to boot.
I've been trying to read about Procfile configurations and gunicorn for several hours and have tried different configurations of this, even trying to put the wsgi file under the application and changing the application name, all to no avail. This seems like something obvious that I am missing. Any ideas?
Updating with a little bit of my project structure below. It is based on the structure from Two Scoops of Django and can be found on the cookiecutter-django project.
base_dir/
|application/
|templates/
|base.html
|users/
|views.py
|model.py
|...
|other_apps/
|config
|wsgi.py
|urls.py
|settings/
|common.py