我有一个Django应用程序我试图在与Gunicorn的Ubunutu VPS上设置,我在运行gunicorn project:application -b myip:8000
时遇到错误。以下是产生的结果:
Traceback (most recent call last):
File "/home/user/project/env/bin/gunicorn", line 11, in <module>
sys.exit(run())
File "/home/user/project/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/home/user/project/env/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 185, in run
super(Application, self).run()
File "/home/user/project/env/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 71, in run
Arbiter(self).run()
File "/home/user/project/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 169, in run
self.manage_workers()
File "/home/user/project/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 477, in manage_workers
self.spawn_workers()
File "/home/user/project/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 542, in spawn_workers
time.sleep(0.1 * random.random())
File "/home/user/project/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 209, in handle_chld
self.reap_workers()
File "/home/user/project/env/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>
我在虚拟环境中使用pip install gunicorn
安装了Gunicorn。 wsgi.py存在并包含WSGI应用程序&#39; application&#39;。我似乎无法弄清问题是什么。任何帮助将不胜感激。
答案 0 :(得分:4)
尝试将您的应用作为 manage.py runserver 运行,因为您有一些错误,因此您无法加载应用。
答案 1 :(得分:0)
除非您的WSGI文件由于某种原因被称为“project.py”,否则您应该使用project.wsgi:application
调用gunicorn。