4

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.

Saša Kalaba
  • 4,241
  • 6
  • 29
  • 52
  • You can read this [section](http://www.obeythetestinggoat.com/book/chapter_making_deployment_production_ready.html#_using_systemd_to_make_sure_gunicorn_starts_on_boot) – nos Jul 02 '18 at 04:32

0 Answers0