当我在项目目录中运行gunicorn时:
/home/dmitry/.virtualenv/my_env/bin/gunicorn videotube.wsgi:application -c /path/to/project/settings/gunicorn/production.py
一切都很好:
2014-07-31 14:03:12 [2940] [INFO] Listening at: unix:/tmp/tonna-porno.com.sock (2940)
但如果我使用supervisor
(这是配置文件)做同样的事情:
[program:project_name]
command=/home/dmitry/.virtualenv/my_env/bin/gunicorn videotube.wsgi:application -c /path/to/project/settings/gunicorn/production.py
directory=/path/to/project
user=dmitry
autostart=true
autorestart=true
stderr_logfile=/home/dmitry/logs/project_name/errors.log
stdout_logfile=/home/dmitry/logs/project_name/access.log
我可以在日志中看到:
2014-07-31 13:48:48 [2776] [INFO] Listening at: http://127.0.0.1:8000 (2776)
我甚至试图将套接字地址放到命令中:
command="/home/dmitry/.virtualenv/tonna_porno/bin/gunicorn -b unix:/tmp/mysock.com.sock videotube.wsgi:application"
但是gunicorn仍然会监听TCP端口。