python - Gunicorn 无法连接到套接字错误 [在 vagrant 中运行]

标签 python django gunicorn django-wsgi

我正在使用 Gunicorn 运行 django 应用程序,但遇到了一个奇怪的问题。

该命令不起作用 -

(venv)-bash-4.1$ gunicorn myapp.wsgi -b unix:/opt/myapp/var/run/app.sock 
[2016-09-15 06:04:12 +0000] [10100] [INFO] Starting gunicorn 19.4.5
[2016-09-15 06:04:12 +0000] [10100] [ERROR] Retrying in 1 second.
[2016-09-15 06:04:13 +0000] [10100] [ERROR] Retrying in 1 second.
[2016-09-15 06:04:14 +0000] [10100] [ERROR] Retrying in 1 second.
[2016-09-15 06:04:15 +0000] [10100] [ERROR] Retrying in 1 second.
[2016-09-15 06:04:16 +0000] [10100] [ERROR] Retrying in 1 second.
[2016-09-15 06:04:17 +0000] [10100] [ERROR] Can't connect to /opt/myapp/var/run/app.sock

这个有效

(venv)-bash-4.1$ gunicorn myapp.wsgi -b unix:/tmp/myapp.sock 
    [2016-09-15 06:04:58 +0000] [10105] [INFO] Starting gunicorn 19.4.5
    [2016-09-15 06:04:58 +0000] [10105] [INFO] Listening at: unix:/tmp/myapp.sock (10105)
    [2016-09-15 06:04:58 +0000] [10105] [INFO] Using worker: sync
    [2016-09-15 06:04:58 +0000] [10110] [INFO] Booting worker with pid: 10110
    [2016-09-15 06:05:01 +0000] [10105] [INFO] Handling signal: int

假设,我对/opt/myapp/var/run/目录有 777 权限。唯一的区别是套接字文件的位置。

更新:此应用程序在以 vagrant 启动的 virtualbox VM 中运行,并且/opt/myapp 使用文件共享选项进行映射。

最佳答案

我刚刚发现无法在 virtualbox 共享目录上创建套接字文件。

这个链接对我有帮助。 https://github.com/burke/zeus/issues/231

关于python - Gunicorn 无法连接到套接字错误 [在 vagrant 中运行],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39504485/

相关文章:

python - 无法发送请求 : Only unicode objects are escapable. 没有任何类型 <class 'NoneType' >

django - 在同一个 python 进程上运行多个站点

python - gunicorn 在 heroku 中导致错误

python - 按列对python数组/recarray进行排序

python - 什么是 "inheritable alternative constructors"?

python - 将复杂的 NumPy 数组转换为 (n, 2)-实部和虚部数组

Django 管理媒体未加载

python - 使用 Django admin 复制模型

django - 未知命令 : 'collectstatic' while deploying a Mezzanine app on Heroku

python - 大额的子集和