在尝试开始时,gunicorn无法启动

时间:2014-06-12 17:24:05

标签: python django nginx gunicorn

我通过以下命令手动启动nginx / gunicorn:

sudo nginx -c /etc/nginx/nginx.conf; sudo /usr/local/bin/gunicorn -c /home/user/virtualenv/gunicorn_config.py mydjangoproject.wsgi;

我已经对路径进行了三次检查,但是当我执行上述命令时,它似乎无法找到我的django项目(mydjangoproject)。

我加倍检查sys.path它确实包含了我的项目路径(因此我的项目位于pythonpath

我得到的输出如下:

[3207] [INFO] Starting gunicorn 18.0
[3207] [INFO] Listening at: http://127.0.0.1:8001 (3207)
[3207] [INFO] Using worker: sync
[INFO] Booting worker with pid: 3212
[ERROR] Exception in worker process:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 495, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 106, in init_process
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 114, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 62, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 354, in import_app
    __import__(module)
ImportError: No module named mydjangoproject.wsgi
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

Nginx在这里开始很好,它的gunicorn似乎无法识别我的django项目。

任何人都可以看到可能出现的问题吗?

谢谢

1 个答案:

答案 0 :(得分:0)

感谢用户Mik.ro对此帖子的建议: How to debug gunicorn failure issues?(Worker failed to boot)

您需要在manage.py位于

的位置执行此操作