gunicorn: Can't connect to gunicorn.sock
I am using Django 1.8 and I want to run my application with gunicorn.
I can run it OK from the command line binding to my IP:
gunicorn myapp.wsgi:application --bind xx.xx.xx.xx:8001
But now I want to run it via a Unix socket:
gunicorn myapp.wsgi:application --bind=unix$/webapps/myapp/run/gunicorn.sock
I get this error:
[2015-08-23 07:38:04 +0000] [18598] [INFO] Starting gunicorn 19.3.0
[2015-08-23 07:38:04 +0000] [18598] [ERROR] Retrying in 1 second.
[2015-08-23 07:38:05 +0000] [18598] [ERROR] Retrying in 1 second.
[2015-08-23 07:38:06 +0000] [18598] [ERROR] Retrying in 1 second.
[2015-08-23 07:38:07 +0000] [18598] [ERROR] Retrying in 1 second.
[2015-08-23 07:38:08 +0000] [18598] [ERROR] Retrying in 1 second.
[2015-08-23 07:38:09 +0000] [18598] [ERROR] Can't connect to $/webapps/myapp/run/gunicorn.sock
If I do ls -al /webapps/myapp/run
I see that the socket file does exist, though it is empty:
srwxrwxrwx 1 opuser webapps 0 Aug 23 07:22 /webapps/myapp/run/gunicorn.sock
How can I fix this?
I eventually want to run gunicorn
as the user opuser
, I've tried appending --user opuser --group webapps
to the gunicorn command, but still get the same error.
根据文档(http://gunicorn-docs.readthedocs.org/en/latest/run.html),您应该使用: unix:$(PATH)
,这意味着您的命令应为:
gunicorn myapp.wsgi:application --bind=unix:/webapps/myapp/run/gunicorn.sock
Simply use following command without double quotes: "gunicorn appname.wsgi". Make sure you run this command where your wsgi.py is located.
链接地址: http://www.djcxy.com/p/28602.html上一篇: 查看动画在使用命名视图时不起作用