Avinash jaiswal
Avinash jaiswal

Reputation: 11

Gunicorn Failed to start Service (Unknown section 'Service'. Ignoring.)

I am setting up Django Project on Digital Ocean with Nginx. I am getting error on journalctl -u gunicorn.socket this command. Got this Error

**

    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.

**

Here is my gunicorn Socket file

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

Gunicorn Service File:

**[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**

Any Answer Please.

Upvotes: 1

Views: 3217

Answers (1)

with this settings you need to have file /var/www/html/sandbox/sandbox/wsgi.py

because you set WorkingDirectory=/var/www/html/sandbox

and in ExecStart you write sandbox.wsgi:application

so gunicorn try to enter to WorkingDirectory and find there sandbox/wsgi.py

Upvotes: 3

Related Questions