У меня есть настройки Django и Gunicorn. Если я запускаю службу Gunicorn из командной строки следующим образом:
gunicorn --bind 0.0.0.0:8000 first.wsgi
из следующего рабочего каталога:
~/code/firstdjangoproject/first
все работает как положено.
Однако когдаЯ пытаюсь настроить службу с systemd
для gunicorn со следующей конфигурацией gunicorn.service
:
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=pi
Group=www-data
WorkingDirectory=/home/pi/firstdjangoproject
ExecStart=/usr/local/bin/gunicorn \
--access-logfile - \
--error-logfile - /home/pi/error.log \
--workers 3 \
--bind unix:/run/gunicorn.sock \
first.wsgi:application
[Install]
WantedBy=multi-user.target
При попытке получить доступ к сайту с помощью curl --unix-socket /run/gunicorn.sock localhost
я получаю следующую ошибку:
curl: (56) Recv failure: Connection reset by peer
Когда я просматриваю логи sudo systemctl status gunicorn
я получаю следующее:
● gunicorn.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/gunicorn.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-09-30 22:14:14 CEST; 7s ago
Process: 3070 ExecStart=/usr/local/bin/gunicorn --access-logfile - --error-logfile - /home/pi/error.log --workers 3 --bind uni
Main PID: 3070 (code=exited, status=210/CHROOT)
sep 30 22:14:14 raspberrypi systemd[1]: Started gunicorn daemon.
sep 30 22:14:14 raspberrypi systemd[1]: gunicorn.service: Main process exited, code=exited, status=210/CHROOT
sep 30 22:14:14 raspberrypi systemd[1]: gunicorn.service: Unit entered failed state.
sep 30 22:14:14 raspberrypi systemd[1]: gunicorn.service: Failed with result 'exit-code'.
sep 30 22:14:14 raspberrypi systemd[1]: gunicorn.service: Start request repeated too quickly.
sep 30 22:14:14 raspberrypi systemd[1]: Failed to start gunicorn daemon.
sep 30 22:14:14 raspberrypi systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Кто-нибудь знает, что я здесь не так делаю?