gunicorn.service: Failed at step CHDIR spawning */env/bin/gunicorn: No such file or directory

Viewed 2297

gunicorn.service cannot open WorkingDirectory and the gunicorn executable. I think it's about permissions but I don't know how I can solve it.

sudo systemctl status gunicorn:

Mar 15 12:12:42 ns1.localhost.com systemd[1]: Started gunicorn daemon.
Mar 15 12:12:42 ns1.localhost.com systemd[16439]: gunicorn.service: Changing to the requested working directory failed: No such file or directory
Mar 15 12:12:42 ns1.localhost.com systemd[16439]: gunicorn.service: Failed at step CHDIR spawning /home/radarkes-api/env/bin/gunicorn: No such file or directory
Mar 15 12:12:42 ns1.localhost.com systemd[1]: gunicorn.service: Main process exited, code=exited, status=200/CHDIR
Mar 15 12:12:42 ns1.localhost.com systemd[1]: gunicorn.service: Failed with result 'exit-code'.

/etc/systemd/system/gunicorn.service:

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

[Service]
User=root
Group=www-data
WorkingDirectory=/home/radarkes-api/src
ExecStart=/home/radarkes-api/env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/radarkes-api/src/core.sock core.wsgi:application

[Install]
WantedBy=multi-user.target

I can run /home/radarkes-api/env/bin/gunicorn manually, this is the output which means I can access the gunicorn executable:

usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: No application module specified.

I tried:

  • Adding "source /home/radarkes-api/env/bin/activate &&" at the start of ExecStart.
  • chmod -R 777 /home/radarkes-api

tree -d -L 2 /home/radarkes-api/:

radarkes-api/
├── env
│   ├── bin
│   └── lib
└── src
    ├── api
    └── core

How can I solve this?

0 Answers
Related