UK2AU
UK2AU

Reputation: 165

Heroku Django app returning error heroku/router: at=error code=H10 desc="App crashed"

My error in log, working on localhost deploys ok then i get unstuck!

Feb 19 16:32:44 mysite heroku/router: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=mysite.herokuapp.com request_id=0bf47868-4a4f-41c3-ba3e-9035d543e35 fwd="121.211.230.38" dyno= connect= service= status=503 bytes=

Checked all the previos post but nothing is working.

Procfile;

web: gunicorn nmn.wsgi --log-file -

wgsi.py:

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

from django.core.wsgi import get_wsgi_application
from dj_static import Cling

application = Cling(get_wsgi_application())

Please can someone help? anyone?

Feb 19 18:28:37 newmusicninja heroku/web.1:  Starting process with command `gunicorn nmn.wsgi --log-file -` 
Feb 19 18:28:39 newmusicninja app/web.1:  [2015-02-20 02:28:39 +0000] [3] [INFO] Listening at: http://0.0.0.0:14199 (3) 
Feb 19 18:28:39 newmusicninja app/web.1:  [2015-02-20 02:28:39 +0000] [3] [INFO] Using worker: sync 
Feb 19 18:28:39 newmusicninja app/web.1:  [2015-02-20 02:28:39 +0000] [9] [INFO] Booting worker with pid: 9 
Feb 19 18:28:39 newmusicninja app/web.1:  [2015-02-20 02:28:39 +0000] [3] [INFO] Starting gunicorn 19.1.1 
Feb 19 18:28:39 newmusicninja app/web.1:  [2015-02-20 02:28:39 +0000] [9] [ERROR] Exception in worker process: 
Feb 19 18:28:39 newmusicninja app/web.1:  Traceback (most recent call last): 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 
Feb 19 18:28:39 newmusicninja app/web.1:      worker.init_process() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 114, in init_process 
Feb 19 18:28:39 newmusicninja app/web.1:      self.wsgi = self.app.wsgi() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 66, in wsgi 
Feb 19 18:28:39 newmusicninja app/web.1:      self.callable = self.load() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 
Feb 19 18:28:39 newmusicninja app/web.1:      return self.load_wsgiapp() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 
Feb 19 18:28:39 newmusicninja app/web.1:      return util.import_app(self.app_uri) 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 356, in import_app 
Feb 19 18:28:39 newmusicninja app/web.1:      __import__(module) 
Feb 19 18:28:39 newmusicninja app/web.1:  ImportError: No module named nmn.wsgi 
Feb 19 18:28:39 newmusicninja app/web.1:  Traceback (most recent call last): 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 
Feb 19 18:28:39 newmusicninja app/web.1:      worker.init_process() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 114, in init_process 
Feb 19 18:28:39 newmusicninja app/web.1:      self.wsgi = self.app.wsgi() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 66, in wsgi 
Feb 19 18:28:39 newmusicninja app/web.1:      self.callable = self.load() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 
Feb 19 18:28:39 newmusicninja app/web.1:      return self.load_wsgiapp() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 
Feb 19 18:28:39 newmusicninja app/web.1:      return util.import_app(self.app_uri) 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 356, in import_app 
Feb 19 18:28:39 newmusicninja app/web.1:      __import__(module) 
Feb 19 18:28:39 newmusicninja app/web.1:  ImportError: No module named nmn.wsgi 
Feb 19 18:28:39 newmusicninja app/web.1:  [2015-02-20 02:28:39 +0000] [9] [INFO] Worker exiting (pid: 9) 
Feb 19 18:28:39 newmusicninja app/web.1:  Traceback (most recent call last): 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/bin/gunicorn", line 11, in <module> 
Feb 19 18:28:39 newmusicninja app/web.1:      sys.exit(run()) 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run 
Feb 19 18:28:39 newmusicninja app/web.1:      WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 185, in run 
Feb 19 18:28:39 newmusicninja app/web.1:      super(Application, self).run() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 71, in run 
Feb 19 18:28:39 newmusicninja app/web.1:      Arbiter(self).run() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 169, in run 
Feb 19 18:28:39 newmusicninja app/web.1:      self.manage_workers() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 477, in manage_workers 
Feb 19 18:28:39 newmusicninja app/web.1:      self.spawn_workers() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 542, in spawn_workers 
Feb 19 18:28:39 newmusicninja app/web.1:      time.sleep(0.1 * random.random()) 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 209, in handle_chld 
Feb 19 18:28:39 newmusicninja app/web.1:      self.reap_workers() 
Feb 19 18:28:39 newmusicninja app/web.1:    File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 459, in reap_workers 
Feb 19 18:28:39 newmusicninja app/web.1:      raise HaltServer(reason, self.WORKER_BOOT_ERROR) 
Feb 19 18:28:39 newmusicninja app/web.1:  gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3> 
Feb 19 18:28:40 newmusicninja heroku/web.1:  Process exited with status 1 
Feb 19 18:28:40 newmusicninja heroku/web.1:  State changed from starting to crashed 

Upvotes: 4

Views: 11629

Answers (7)

Surveyor Jr
Surveyor Jr

Reputation: 408

A simple pip install gunicorn resolved my issue.

I realised I deployed to Heroku and forgot to install gunicorn.

Dont forget to updated the requirements.txt file too

Upvotes: 0

Vincent Juma
Vincent Juma

Reputation: 1

check Procfile if it contains your project name! if not, edit-

web: gunicorn your_project.wsgi --log-file

else;

pip install pipenv

Upvotes: 0

akinlex
akinlex

Reputation: 23

this is where you error is

ImportError: No module named nmn.wsgi

you might be using an outdated package, try updating the package that is using nmn.wsgi

Upvotes: 0

Mansoor Ul Haq
Mansoor Ul Haq

Reputation: 330

I have faced this error because of an error in wsgi.py module in this line. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')

Upvotes: 0

Tpircsnart
Tpircsnart

Reputation: 47

In my case:

pip install django-heroku

in cmd prompt,

......................................................

then modified

django-heroku==0.3.1

in requirements.txt

......................................................

and the last, add

import django_heroku
django_heroku.settings(locals())

in very bottom in settings.py

Upvotes: 0

Ramandeep Singh
Ramandeep Singh

Reputation: 558

A very simple solution I don't know how it works but its actually effective. Just install pipenv by typing the following in cmd pip install pipenv. After this try to push again and it will not crash.I hope it works.

Upvotes: 0

Raja Simon
Raja Simon

Reputation: 10305

Why you are refer gunicorn to nmn ( Is that actual project ).

gunicorn just needs to be called with the location of a module containing a WSGI application object named application

(i,e)

mysite
    -- mysite
           -- settings.py
           -- wsgi.py
           -- urls.py
    -- yourapp
           -- models.py
           -- admin.py
           -- views.py

So in your Procfile include this will work web: gunicorn mysite.wsgi --log-file -

Upvotes: 2

Related Questions