Python gunicorn.errors.HaltServer: <HaltServer 'Worker 启动失败。' 3>
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24639907/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
提问by Yannick
I've installed gunicorn inside my virtualenv.
我已经在我的 virtualenv 中安装了 gunicorn。
From this directory:
从这个目录:
manage.py
/onbytes/wsgi.py
I run the following:
我运行以下命令:
gunicorn onbytes.wsgi:application
And I get the following error:
我收到以下错误:
Traceback (most recent call last):
File "/home/ymorin007/.virtualenvs/onbytes.com/bin/gunicorn", line 9, in <module>
load_entry_point('gunicorn==19.0.0', 'console_scripts', 'gunicorn')()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 166, in run
super(Application, self).run()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 71, in run
Arbiter(self).run()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 169, in run
self.manage_workers()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 477, in manage_workers
self.spawn_workers()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 537, in spawn_workers
time.sleep(0.1 * random.random())
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 209, in handle_chld
self.reap_workers()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 459, in reap_workers
raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
running gunicorn onbytes.wsgi:application --preload will get me this error:
运行 gunicorn onbytes.wsgi:application --preload 会给我这个错误:
Traceback (most recent call last):
File "/home/ymorin007/.virtualenvs/onbytes.com/bin/gunicorn", line 9, in <module>
load_entry_point('gunicorn==19.0.0', 'console_scripts', 'gunicorn')()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 166, in run
super(Application, self).run()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 71, in run
Arbiter(self).run()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 57, in __init__
self.setup(app)
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 113, in setup
self.app.wsgi()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 66, in wsgi
self.callable = self.load()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/ymorin007/.virtualenvs/onbytes.com/local/lib/python2.7/site-packages/gunicorn/util.py", line 356, in import_app
__import__(module)
File "/home/ymorin007/sites/onbytes.com/src/onbytes/wsgi.py", line 8, in <module>
from django.core.wsgi import get_wsgi_application
ImportError: No module named django.core.wsgi
回答by Micho
I had a similar problem and it was because i was running the command in the wrong directory. In a standard django installation, try running gunicorn in the same directory that 'manage.py'
我有一个类似的问题,这是因为我在错误的目录中运行命令。在标准 django 安装中,尝试在“manage.py”所在的同一目录中运行 gunicorn
回答by Mauro
Probably there is an issue in your application, not in gunicorn.
您的应用程序中可能存在问题,而不是 gunicorn。
Try:
尝试:
gunicorn --log-file=- onbytes.wsgi:application
Since the version R19, Gunicorn doesn't log by default in the console and the --debug option was deprecated.
从 R19 版本开始,Gunicorn 默认不会在控制台中记录日志,并且不推荐使用 --debug 选项。
回答by Hanynowsky
Adding --preload
the gunincorn
command showed me that I had to do :
添加--preload
的gunincorn
命令给我看,我不得不这样做:
pip install ordereddict
That package was missing.
那个包裹不见了。
回答by Ali-T
in my case after adding --preload
to Procfile
, I understand that I should install psycopg2-binary
with pip:
就我而言,添加--preload
到 之后Procfile
,我知道我应该psycopg2-binary
使用 pip安装:
pip install psycopg2-binary