I have a Django project that I run with gunicorn.
My manage.py file is in /home/Projects/myproject/myproject
.
My virtualenv is in /home/myproject
.
In /lib/systemd/system
I created a myproject.service
file:
[Unit]
Description=My Project
After=network.target
[Service]
User=my_user
Group=my_group
WorkingDirectory=/home/Projects/myproject/myproject
ExecStart= ???
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
I want to know how to properly configure my service file so that it can run my gunicorn start server command on server restart, failure, etc.