我收到以下错误日志,其中backend当然是我的Django项目的名称。我查看了SO上的其他相关问答,但无法获得相关内容。
[2015-07-12 12:18:04 +0000] [17089] [INFO] Starting gunicorn 19.3.0
[2015-07-12 12:18:04 +0000] [17089] [INFO] Listening at: http://127.0.0.1:8002 (17089)
[2015-07-12 12:18:04 +0000] [17089] [INFO] Using worker: sync
[2015-07-12 12:18:04 +0000] [17098] [INFO] Booting worker with pid: 17098
[2015-07-12 12:18:04 +0000] [17098] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process
self.wsgi = self.app.wsgi()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app
__import__(module)
ImportError: No module named backend.wsgi
Traceback (most recent call last):
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process
self.wsgi = self.app.wsgi()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app
__import__(module)
ImportError: No module named backend.wsgi
[2015-07-12 12:18:04 +0000] [17098] [INFO] Worker exiting (pid: 17098)
Traceback (most recent call last):
File "/home/ubuntu/.virtualenvs/backend/bin/gunicorn", line 11, in <module>
sys.exit(run())
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 189, in run
super(Application, self).run()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in run
Arbiter(self).run()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 174, in run
self.manage_workers()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 477, in manage_workers
self.spawn_workers()
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 541, in spawn_workers
time.sleep(0.1 * random.random())
File "/home/ubuntu/.virtualenvs/backend/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 214, in handle_chld
self.reap_workers()
File "/home/ubuntu/.virtualenvs/backend/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>
如果您需要其他信息,请告诉我们。 编辑: 的 supervisor.conf
[program:%(PROJECT_NAME)s]
command=%(PROJECT_PATH)s/start_gunicorn.bash
directory=%(PROJECT_PATH)s
user=www-data
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=%(PROJECT_PATH)s/logs/supervisorconf.log
start_gunicorn.bash
#!/bin/bash
# Starts the Gunicorn server
set -e
# Activate the virtualenv for this project
%(ACTIVATE)s
# Start gunicorn going
exec gunicorn %(PROJECT_NAME)s.wsgi:application -c %(PROJECT_PATH)s/gunicorn.conf.py