我已经在我的virtualenv中安装了gunicorn。
从这个目录:
manage.py
/onbytes/wsgi.py
我运行以下内容:
gunicorn onbytes.wsgi:application
我收到以下错误:
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>
运行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
答案 0 :(得分:32)
你的申请可能存在问题,而不是枪手。
尝试:
gunicorn --log-file=- onbytes.wsgi:application
自版本R19起,Gunicorn默认情况下不会在控制台中记录,并且不推荐使用--debug选项。
答案 1 :(得分:18)
添加--preload
gunincorn
命令向我展示了我必须这样做:
pip install ordereddict
那个包裹丢失了。
答案 2 :(得分:12)
我有类似的问题,因为我在错误的目录中运行命令。在标准的django安装中,尝试在&#39; manage.py&#39;的同一目录中运行gunicorn。
答案 3 :(得分:0)
在我将--preload
添加到Procfile
之后,我了解我应该使用pip安装psycopg2-binary
:
pip install psycopg2-binary