NGINX/Python/Gunicorn – Failed at Step Exec – No such file or directory

I’ve set up a simple flask ask being served by NGINX and Gunicorn.

When I run Gunicorn on it’s own (0.0.0.0:5000) it works, so I’m sure the issue lies with my .service file. It looks like:

[Unit]
Description=Guncicorn server to servce mcname
After=network.target

[Service]
User=tom
Group=www-data
WorkingDirectory=/home/tom/mcname
Environment="PATH=/home/tom/mcname/mcname-env/bin"
ExecStart=/home/tom/mcname/mcname-env/bin/gunicorn --workers 3 --bind unix:/home/tom/mcname/mcname.sock -m 007 mcname.wsgi:app

[Install]
WantedBy=multi-user.target

And the output of sudo cat /var/log/syslog shows mcname.service: Failed at step EXEC spawning /home/tom/mcname/mcname-env/bin/gunicorn: No such file or directory.

Ok… but then

pwd: /home/tom/mcname/mcname-env/bin

and ls:
activate activate.fish easy_install flask gunicorn_django pip pip2.7 python2 python-config
activate.csh activate_this.py easy_install-2.7 gunicorn gunicorn_paster pip2 python python2.7 wheel

So the file definitely does exist (/home/tom/mcname/mcname-env/bin/gunicorn) and the directory is owned by user tom who is in my .service file. I don’t understand why the .service file cannot find the gunicorn file to launch the process. Any ideas why this error is occurring?

Related:


Leave a Reply