Heroku Django app返回错误heroku / router:at =错误代码= H10 desc =“App崩溃”

时间:2015-02-20 01:15:56

标签: django macos postgresql heroku

我在日志中的错误,在localhost上工作就可以了,然后我就解开了!

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 =

检查了所有的帖子,但没有任何效果。

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())

请有人帮忙吗?任何人吗?

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 

6 个答案:

答案 0 :(得分:1)

为什么你将gunicorn引用到nmn(这是实际项目)。

  

只需要使用包含名为application

的WSGI应用程序对象的模块的位置调用gunicorn

(I,E)

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

因此,在您的Procfile中,这将有效web: gunicorn mysite.wsgi --log-file -

答案 1 :(得分:0)

一个非常简单的解决方案我不知道它是如何工作的,但它实际上是有效的。 只需在cmd pip install pipenv中键入以下内容即可安装pipenv。 在此尝试再次推动它不会崩溃。我希望它的工作原理。

答案 2 :(得分:0)

就我而言:

pip install django-heroku

在cmd提示符下,

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

然后修改

django-heroku==0.3.1

在requirements.txt中

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

最后,添加

import django_heroku
django_heroku.settings(locals())

在settings.py的最底部

答案 3 :(得分:0)

由于此行中的wsgi.py模块错误,我遇到了此错误。 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')

答案 4 :(得分:0)

这是您的错误所在

ImportError: No module named nmn.wsgi

您可能正在使用过时的软件包,请尝试更新使用nmn.wsgi的软件包

答案 5 :(得分:0)

检查 Procfile 是否包含您的项目名称!如果没有,请编辑-

web: gunicorn your_project.wsgi --log-file

其他;

pip 安装 pipenv