【问题标题】:Gunicorn can't connect to socket error [Running in vagrant]Gunicorn 无法连接到套接字错误 [Running in vagrant]
【发布时间】:2017-01-23 02:08:01
【问题描述】:

我正在使用 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 权限。唯一不同的是socket文件的位置。

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

【问题讨论】:

  • 确保整个目录结构/opt/myapp/var/run/可以被网络服务器的用户访问。

标签: python django gunicorn django-wsgi


【解决方案1】:

我刚刚发现不能在virtualbox共享目录上创建socket文件。

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

【讨论】:

    猜你喜欢
    • 2012-07-24
    • 2013-04-13
    • 1970-01-01
    • 1970-01-01
    • 2015-02-22
    • 2018-03-12
    • 2011-04-07
    • 2011-10-03
    • 1970-01-01
    相关资源
    最近更新 更多