heroku django app崩溃了

时间:2016-07-18 00:12:00

标签: python django heroku

我试图启动并运行我的应用程序,但我一直在收到应用程序错误。当我看看我的dynos时,我得到以下消息:

Billys-MBP:gymmie-test BillyWu$ heroku ps
Free dyno hours quota remaining this month: 550h 0m (100%)
For more information on dyno sleeping and how to upgrade, see:
https://devcenter.heroku.com/articles/dyno-sleeping

=== web (Free): gunicorn ebgymmie.wsgi --log-file - (1)
web.1: crashed 2016/07/17 19:48:58 -0400 (~ 2s ago)

以下是我的日志:

Billys-MBP:gymmie-test BillyWu$ heroku logs
2016-07-17T23:39:56.932873+00:00 app[web.1]: ImportError: No module named     ebgymmie.wsgi
2016-07-17T23:39:56.932867+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2016-07-17T23:39:56.932868+00:00 app[web.1]:     self.callable = self.load()
2016-07-17T23:39:56.932966+00:00 app[web.1]: [2016-07-17 23:39:56 +0000] [10]  [INFO] Worker exiting (pid: 10)
2016-07-17T23:39:56.944952+00:00 app[web.1]: [2016-07-17 23:39:56 +0000] [3] [INFO] Reason: Worker failed to boot.
2016-07-17T23:39:56.944851+00:00 app[web.1]: [2016-07-17 23:39:56 +0000] [3] [INFO] Shutting down: Master
2016-07-17T23:39:57.674567+00:00 heroku[web.1]: Process exited with status 3
2016-07-17T23:39:57.690362+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-17T23:39:57.691534+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-17T23:40:02.101802+00:00 heroku[web.1]: Starting process with command `gunicorn ebgymmie.wsgi --log-file -`
2016-07-17T23:40:04.620754+00:00 app[web.1]: [2016-07-17 23:40:04 +0000] [9] [ERROR] Exception in worker process:
2016-07-17T23:40:04.620795+00:00 app[web.1]:     worker.init_process()
2016-07-17T23:40:04.607817+00:00 app[web.1]: [2016-07-17 23:40:04 +0000] [3] [INFO] Starting gunicorn 19.4.5
2016-07-17T23:40:04.608451+00:00 app[web.1]: [2016-07-17 23:40:04 +0000] [3] [INFO] Listening at: http://0.0.0.0:53204 (3)
2016-07-17T23:40:04.620779+00:00 app[web.1]: Traceback (most recent call last):
2016-07-17T23:40:04.608563+00:00 app[web.1]: [2016-07-17 23:40:04 +0000] [3] [INFO] Using worker: sync
2016-07-17T23:40:04.620788+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
2016-07-17T23:40:04.618293+00:00 app[web.1]: [2016-07-17 23:40:04 +0000] [9] [INFO] Booting worker with pid: 9
2016-07-17T23:40:04.620796+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
2016-07-17T23:40:04.620798+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
2016-07-17T23:40:04.620807+00:00 app[web.1]:     self.callable = self.load()
2016-07-17T23:40:04.620797+00:00 app[web.1]:     self.load_wsgi()
2016-07-17T23:40:04.620808+00:00 app[web.1]:     return self.load_wsgiapp()
2016-07-17T23:40:04.620798+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2016-07-17T23:40:04.620806+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2016-07-17T23:40:04.620807+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-07-17T23:40:04.620808+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-07-17T23:40:04.620811+00:00 app[web.1]: ImportError: No module named ebgymmie.wsgi
2016-07-17T23:40:04.620814+00:00 app[web.1]:     self.load_wsgi()
2016-07-17T23:40:04.620814+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
2016-07-17T23:40:04.620815+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2016-07-17T23:40:04.620815+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2016-07-17T23:40:04.620816+00:00 app[web.1]:     self.callable = self.load()
2016-07-17T23:40:04.620817+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-07-17T23:40:04.620811+00:00 app[web.1]: Traceback (most recent call last):
2016-07-17T23:40:04.620809+00:00 app[web.1]:     return util.import_app(self.app_uri)
2016-07-17T23:40:04.620810+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
2016-07-17T23:40:04.620812+00:00 app[web.1]:     worker.init_process()
2016-07-17T23:40:04.620817+00:00 app[web.1]:     return self.load_wsgiapp()
2016-07-17T23:40:04.620810+00:00 app[web.1]:     __import__(module)
2016-07-17T23:40:04.620812+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
2016-07-17T23:40:04.620813+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
2016-07-17T23:40:04.620818+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-07-17T23:40:04.620819+00:00 app[web.1]:     return util.import_app(self.app_uri)
2016-07-17T23:40:04.620819+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
2016-07-17T23:40:04.620820+00:00 app[web.1]:     __import__(module)
2016-07-17T23:40:04.620820+00:00 app[web.1]: ImportError: No module named ebgymmie.wsgi
2016-07-17T23:40:04.620825+00:00 app[web.1]: [2016-07-17 23:40:04 +0000] [9] [INFO] Worker exiting (pid: 9)
2016-07-17T23:40:04.658612+00:00 app[web.1]:     worker.init_process()
2016-07-17T23:40:04.648227+00:00 app[web.1]: [2016-07-17 23:40:04 +0000] [10] [INFO] Booting worker with pid: 10
2016-07-17T23:40:04.658614+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
2016-07-17T23:40:04.658612+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
2016-07-17T23:40:04.658614+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2016-07-17T23:40:04.658646+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2016-07-17T23:40:04.658648+00:00 app[web.1]:     self.callable = self.load()
2016-07-17T23:40:04.658593+00:00 app[web.1]: [2016-07-17 23:40:04 +0000] [10] [ERROR] Exception in worker process:
2016-07-17T23:40:04.658601+00:00 app[web.1]: Traceback (most recent call last):
2016-07-17T23:40:04.658649+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-07-17T23:40:04.658649+00:00 app[web.1]:     return self.load_wsgiapp()
2016-07-17T23:40:04.658650+00:00 app[web.1]:     return util.import_app(self.app_uri)
2016-07-17T23:40:04.658613+00:00 app[web.1]:     self.load_wsgi()
2016-07-17T23:40:04.658610+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
2016-07-17T23:40:04.658651+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
2016-07-17T23:40:04.658651+00:00 app[web.1]:     __import__(module)
2016-07-17T23:40:04.658650+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-07-17T23:40:04.658653+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
2016-07-17T23:40:04.658654+00:00 app[web.1]:     worker.init_process()
2016-07-17T23:40:04.658653+00:00 app[web.1]: Traceback (most recent call last):
2016-07-17T23:40:04.658655+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
2016-07-17T23:40:04.658652+00:00 app[web.1]: ImportError: No module named ebgymmie.wsgi
2016-07-17T23:40:04.658656+00:00 app[web.1]:     self.load_wsgi()
2016-07-17T23:40:04.658656+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
2016-07-17T23:40:04.658657+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2016-07-17T23:40:04.658658+00:00 app[web.1]:     self.callable = self.load()
2016-07-17T23:40:04.658659+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-07-17T23:40:04.658660+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-07-17T23:40:04.658659+00:00 app[web.1]:     return self.load_wsgiapp()
2016-07-17T23:40:04.658661+00:00 app[web.1]:     return util.import_app(self.app_uri)
2016-07-17T23:40:04.658661+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
2016-07-17T23:40:04.658662+00:00 app[web.1]:     __import__(module)
2016-07-17T23:40:04.658663+00:00 app[web.1]: ImportError: No module named ebgymmie.wsgi
2016-07-17T23:40:04.658714+00:00 app[web.1]: [2016-07-17 23:40:04 +0000] [10] [INFO] Worker exiting (pid: 10)
2016-07-17T23:40:04.705202+00:00 app[web.1]: Traceback (most recent call last):
2016-07-17T23:40:04.705236+00:00 app[web.1]:     sys.exit(run())
2016-07-17T23:40:04.658657+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2016-07-17T23:40:04.705260+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
2016-07-17T23:40:04.705322+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 192, in run
2016-07-17T23:40:04.705301+00:00 app[web.1]:     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2016-07-17T23:40:04.705209+00:00 app[web.1]:   File "/app/.heroku/python/bin/gunicorn", line 11, in <module>
2016-07-17T23:40:04.705380+00:00 app[web.1]:     super(Application, self).run()
2016-07-17T23:40:04.705416+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in run
2016-07-17T23:40:04.705505+00:00 app[web.1]:     self.manage_workers()
2016-07-17T23:40:04.705437+00:00 app[web.1]:     Arbiter(self).run()
2016-07-17T23:40:04.705513+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 219, in handle_chld
2016-07-17T23:40:04.705569+00:00 app[web.1]:     self.reap_workers()
2016-07-17T23:40:04.705589+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 464, in reap_workers
2016-07-17T23:40:04.705451+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 180, in run
2016-07-17T23:40:04.705681+00:00 app[web.1]:     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2016-07-17T23:40:04.705745+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2016-07-17T23:40:05.827529+00:00 heroku[web.1]: Process exited with status 1
2016-07-17T23:40:05.836983+00:00 heroku[web.1]: State changed from starting to crashed

wsgi.py:

"""
WSGI config for ebgymmie project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ebgymmie.settings")

application = get_wsgi_application()

目录:

gymmie-test-master
   data
   ebgymmie
      __pycache__
          __init__.cpython-35.pyc
          settings.cpython-35.pyc
          urls.cpython-35.pyc
          wsgi.cpython-35.pyc
      settings.py
      urls.py
      wsgi.py
   goals
   Procfile
   manage.py
   README.md
   requirements.txt

我不知道如何解决这个问题,我已经搜索了很多论坛,但我没有到达任何地方。请让我知道如何解决这个问题,谢谢。

1 个答案:

答案 0 :(得分:0)

你的wsgi文件看起来像这样吗?

import os

from django.core.wsgi import get_wsgi_application
from django.conf import settings

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ebgymmie.settings")

application = get_wsgi_application()

if not settings.DEBUG:
    try:
        from dj_static import Cling
        application = Cling(get_wsgi_application())
    except:
        pass