Gunicorn无法启动服务(未知的“服务”部分。正在忽略。)

时间:2020-01-18 06:25:10

标签: django nginx gunicorn digital-ocean

我正在使用Nginx在Digital Ocean上设置Django Project。我在journalctl -u gunicorn.socket这个命令上遇到错误。出现此错误

**

    root@vavaphysio:/var/www/html/sandbox# journalctl -u gunicorn.socket
    -- Logs begin at Mon 2020-01-06 03:17:11 UTC, end at Sat 2020-01-18 06:28:38 UTC. --
    Jan 14 12:08:43 vavaphysio systemd[1]: /etc/systemd/system/gunicorn.socket:6: Unknown section 'Service'. Ignoring.
    Jan 14 12:08:43 vavaphysio systemd[1]: gunicorn.socket: Unit has no Listen setting (ListenStream=, ListenDatagram=, ListenFIFO=, ...). Refusing.


    Jan 16 09:04:14 vavaphysio systemd[1]: Listening on gunicorn socket.
    Jan 16 09:36:44 vavaphysio systemd[1]: gunicorn.socket: Failed with result 'service-start-limit-hit'.
    Jan 16 09:53:47 vavaphysio systemd[1]: Listening on gunicorn socket.

**

这是我的Gunicorn套接字文件

**[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target**

独角兽服务档案:

**[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/var/www/html/sandbox
ExecStart=/var/www/html/sandbox/env/bin/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          sandbox.wsgi:application
[Install]
WantedBy=multi-user.target**

请回答。

1 个答案:

答案 0 :(得分:1)

使用此设置,您需要拥有文件/var/www/html/sandbox/sandbox/wsgi.py

因为您设置了WorkingDirectory=/var/www/html/sandbox

ExecStart中输入sandbox.wsgi:application

所以古尼康尝试尝试进入WorkingDirectory并找到sandbox/wsgi.py