Owen. S
Owen. S

Reputation: 13

Deployed Django app to Heroku results in Error worker failed to boot

I have built an app and deployed it to heroku but when I try to run heroku open I get an error. Heroku logs are as follows. Any ideas?

2015-09-07T00:31:46.184398+00:00 app[web.1]:     % (desc, ENVIRONMENT_VARIABLE))
2015-09-07T00:31:46.184400+00:00 app[web.1]: ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
2015-09-07T00:31:46.184396+00:00 app[web.1]:     self._setup(name)
2015-09-07T00:31:46.184397+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
2015-09-07T00:31:46.184401+00:00 app[web.1]: Traceback (most recent call last):
2015-09-07T00:31:46.184402+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
2015-09-07T00:31:46.184403+00:00 app[web.1]:     worker.init_process()
2015-09-07T00:31:46.184404+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process
2015-09-07T00:31:46.184406+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2015-09-07T00:31:46.184405+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2015-09-07T00:31:46.184407+00:00 app[web.1]:     self.callable = self.load()
2015-09-07T00:31:46.184410+00:00 app[web.1]:     return self.load_wsgiapp()
2015-09-07T00:31:46.184408+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2015-09-07T00:31:46.184411+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2015-09-07T00:31:46.184412+00:00 app[web.1]:     return util.import_app(self.app_uri)
2015-09-07T00:31:46.184414+00:00 app[web.1]:     __import__(module)
2015-09-07T00:31:46.184413+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app
2015-09-07T00:31:46.184415+00:00 app[web.1]:   File "/app/coffeedapp/wsgi.py", line 15, in <module>
2015-09-07T00:31:46.184416+00:00 app[web.1]:     application = Cling(get_wsgi_application())
2015-09-07T00:31:46.184417+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
2015-09-07T00:31:46.184418+00:00 app[web.1]:     django.setup()
2015-09-07T00:31:46.184419+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 17, in setup
2015-09-07T00:31:46.184420+00:00 app[web.1]:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-09-07T00:31:46.184421+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
2015-09-07T00:31:46.184422+00:00 app[web.1]:     self._setup(name)
2015-09-07T00:31:46.184423+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
2015-09-07T00:31:46.184424+00:00 app[web.1]:     % (desc, ENVIRONMENT_VARIABLE))
2015-09-07T00:31:46.184427+00:00 app[web.1]: ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
2015-09-07T00:31:46.184471+00:00 app[web.1]: [2015-09-07 00:31:46 +0000] [10] [INFO] Worker exiting (pid: 10)
2015-09-07T00:31:46.458369+00:00 app[web.1]: [2015-09-07 00:31:46 +0000] [9] [ERROR] Exception in worker process:
2015-09-07T00:31:46.458374+00:00 app[web.1]: Traceback (most recent call last):
2015-09-07T00:31:46.458395+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
2015-09-07T00:31:46.458397+00:00 app[web.1]:     worker.init_process()
2015-09-07T00:31:46.458398+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process
2015-09-07T00:31:46.458399+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2015-09-07T00:31:46.458400+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2015-09-07T00:31:46.458402+00:00 app[web.1]:     self.callable = self.load()
2015-09-07T00:31:46.458403+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2015-09-07T00:31:46.458404+00:00 app[web.1]:     return self.load_wsgiapp()
2015-09-07T00:31:46.458405+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2015-09-07T00:31:46.458406+00:00 app[web.1]:     return util.import_app(self.app_uri)
2015-09-07T00:31:46.458407+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app
2015-09-07T00:31:46.458408+00:00 app[web.1]:     __import__(module)
2015-09-07T00:31:46.458410+00:00 app[web.1]:   File "/app/coffeedapp/wsgi.py", line 15, in <module>
2015-09-07T00:31:46.458411+00:00 app[web.1]:     application = Cling(get_wsgi_application())
2015-09-07T00:31:46.458412+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
2015-09-07T00:31:46.458413+00:00 app[web.1]:     django.setup()
2015-09-07T00:31:46.458414+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 17, in setup
2015-09-07T00:31:46.458415+00:00 app[web.1]:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-09-07T00:31:46.458416+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
2015-09-07T00:31:46.458418+00:00 app[web.1]:     self._setup(name)
2015-09-07T00:31:46.458419+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
2015-09-07T00:31:46.458420+00:00 app[web.1]:     % (desc, ENVIRONMENT_VARIABLE))
2015-09-07T00:31:46.458421+00:00 app[web.1]: ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
2015-09-07T00:31:46.458422+00:00 app[web.1]: Traceback (most recent call last):
2015-09-07T00:31:46.458423+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
2015-09-07T00:31:46.458425+00:00 app[web.1]:     worker.init_process()
2015-09-07T00:31:46.458426+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process
2015-09-07T00:31:46.458427+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2015-09-07T00:31:46.458428+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2015-09-07T00:31:46.458437+00:00 app[web.1]:     self.callable = self.load()
2015-09-07T00:31:46.458438+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2015-09-07T00:31:46.458439+00:00 app[web.1]:     return self.load_wsgiapp()
2015-09-07T00:31:46.458440+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2015-09-07T00:31:46.458441+00:00 app[web.1]:     return util.import_app(self.app_uri)
2015-09-07T00:31:46.458442+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app
2015-09-07T00:31:46.458443+00:00 app[web.1]:     __import__(module)
2015-09-07T00:31:46.458444+00:00 app[web.1]:   File "/app/coffeedapp/wsgi.py", line 15, in <module>
2015-09-07T00:31:46.458446+00:00 app[web.1]:     application = Cling(get_wsgi_application())
2015-09-07T00:31:46.458447+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
2015-09-07T00:31:46.458448+00:00 app[web.1]:     django.setup()
2015-09-07T00:31:46.458449+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 17, in setup
2015-09-07T00:31:46.458450+00:00 app[web.1]:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-09-07T00:31:46.458451+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
2015-09-07T00:31:46.458452+00:00 app[web.1]:     self._setup(name)
2015-09-07T00:31:46.458453+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
2015-09-07T00:31:46.458454+00:00 app[web.1]:     % (desc, ENVIRONMENT_VARIABLE))
2015-09-07T00:31:46.458456+00:00 app[web.1]: ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
2015-09-07T00:31:46.459027+00:00 app[web.1]: [2015-09-07 00:31:46 +0000] [9] [INFO] Worker exiting (pid: 9)
2015-09-07T00:31:46.501264+00:00 app[web.1]: Traceback (most recent call last):
2015-09-07T00:31:46.501310+00:00 app[web.1]:   File "/app/.heroku/python/bin/gunicorn", line 11, in <module>
2015-09-07T00:31:46.501421+00:00 app[web.1]:     sys.exit(run())
2015-09-07T00:31:46.501463+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
2015-09-07T00:31:46.501559+00:00 app[web.1]:     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2015-09-07T00:31:46.501592+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 189, in run
2015-09-07T00:31:46.501699+00:00 app[web.1]:     super(Application, self).run()
2015-09-07T00:31:46.501757+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in run
2015-09-07T00:31:46.501841+00:00 app[web.1]:     Arbiter(self).run()
2015-09-07T00:31:46.501879+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 201, in run
2015-09-07T00:31:46.501971+00:00 app[web.1]:     self.halt(reason=inst.reason, exit_status=inst.exit_status)
2015-09-07T00:31:46.502275+00:00 app[web.1]:     time.sleep(0.1)
2015-09-07T00:31:46.502306+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 214, in handle_chld
2015-09-07T00:31:46.502403+00:00 app[web.1]:     self.reap_workers()
2015-09-07T00:31:46.502434+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 459, in reap_workers
2015-09-07T00:31:46.502558+00:00 app[web.1]:     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2015-09-07T00:31:46.502723+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2015-09-07T00:31:46.502020+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 297, in halt
2015-09-07T00:31:46.502133+00:00 app[web.1]:     self.stop()
2015-09-07T00:31:46.502165+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 342, in stop
2015-09-07T00:31:47.441966+00:00 heroku[web.1]: State changed from starting to crashed
2015-09-07T00:31:47.425687+00:00 heroku[web.1]: Process exited with status 

Upvotes: 1

Views: 1876

Answers (1)

rdegges
rdegges

Reputation: 33824

The Python traceback explains what is happening here, you need to configure your environment variables:

ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

The simplest way to solve this would be to use Heroku's CLI tool to set your DJANGO_SETTINGS_MODULE setting to whatever you have it set to locally (on your development machine) -- usually this is something like mysite.settings.prod (yours is likely different).

You can set this environment variable by running the following CLI command:

$ heroku config:set DJANGO_SETTINGS_MODULE=mysite.settings.prod

Just be sure to replace the value with what your site actually requires =)

Upvotes: 1

Related Questions