how to run django with gunicorn code example

Example 1: gunicorn launch django cmd

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

[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/sammy/myprojectdir
ExecStart=/home/sammy/myprojectdir/myprojectenv/bin/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          myproject.wsgi:application

Example 2: gunicorn launch django cmd

[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock

[Install]
WantedBy=sockets.target

Example 3: gunicorn launch django cmd

sudo nano /etc/systemd/system/gunicorn.service

Example 4: gunicorn launch django cmd

sudo systemctl status gunicorn.socket

Example 5: gunicorn launch django cmd

sudo systemctl start gunicorn.socket
sudo systemctl enable gunicorn.socket