.sock 文件没有出现在带有 gunicorn 的项目目录中

.sock file not appearing in project directory with gunicorn

我正在尝试为我的网络服务器设置 gunicorn,我目前正在学习这个教程:https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04#create-a-gunicorn-systemd-service-file

问题是gunicorn在我的项目目录下没有生成myproject.sock文件。

我在此文件中的配置:/etc/systemd/system/gunicorn.service,如下所示:

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=daniel
Group=www-data
WorkingDirectory=/home/daniel/myproject
ExecStart=/home/daniel/myproject/myproject_venv/bin/python3 home/daniel/myproject/myproject_venv/bin/gunicorn --workers 3 -b :8000     myproject.wsgi:application

[Install]
WantedBy=multi-user.target

我正在使用 Digital Ocean 的 Django 作为我的网络服务器,所以在一开始,服务器就带有文件和目录,例如 django/django_project/django_project。 但是我没有使用已经制作好的文件,而是用新目录创建了一个新项目(正如教程所说)。

查看 gunicorn 错误日志时,在顶部 sudo journalctl -u gunicorn,它说:

Listening at: unix:/home/django/gunicorn.socket (1915)

如上所述,我创建了一个新项目,其目录与 django 不同,因此我正在寻找一种方法来更改 gunicorn 的收听位置。具体来说,我希望它在 home/daniel/myproject/myproject.sock.

收听

很遗憾,myproject.sock 由于某种原因不存在。

我的项目文件归 sudo 用户和组所有,因此 unicorn 可以访问。 WorkingDirectory 应该是正确的。

我将不胜感激任何帮助,因为我对 nginx、unicorn 和 django 还很陌生。

尝试 --bind unix:/home/daniel/myproject/myproject.sock 而不是 -b :8000。我自己没有用过 gunicorn,但我猜它现在绑定到 tcp 端口 8000。