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

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

我在日志中的错误,在localhost上工作部署好然后我得到了解开!

2月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 =

检查所有previos帖子,但没有任何工作。

Procfile;

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

wgsi.py:

1
2
3
4
5
6
7
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())

请有人帮忙吗? 任何人?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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


为什么你把gunicorn引用到nmn(是那个实际的项目)。

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

(I,E)

1
2
3
4
5
6
7
8
9
mysite
    -- mysite
           -- settings.py
           -- wsgi.py
           -- urls.py
    -- yourapp
           -- models.py
           -- admin.py
           -- views.py

所以在你的Procfile包含这将工作web: gunicorn mysite.wsgi --log-file -


就我而言:

1
pip install django-heroku

在cmd提示符下,

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

然后修改

1
django-heroku==0.3.1

在requirements.txt中

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

最后,添加

1
2
import django_heroku
django_heroku.settings(locals())

在settings.py的最底部


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