Piyush S. Wanare
Piyush S. Wanare

Reputation: 4933

How to run multiple Django App Gunicorn systemd?

I have two django projects running on different ports in same ec2 instance, One I have configured with gunicorn system as follows by creating gunicorn.service file at /etc/systemd/system/ which is working awesome if I run the command systemctl start gunicorn. Now I want to run another proect, how can I configure it, currently I am running that using gunicorn command /usr/local/bin/gunicorn --graceful-timeout 30 --bind 0.0.0.0:8690 projectFile.wsgi:application --daemon, Can I add same in gunicorn.service itself. How do I configure multiple projects in gunicorn systemd?

gunicron.service file -

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


[Service]
PIDFile=/tmp/gunicorn.pid
LogFile=/tmp/lgunicorn.log
User=root
Group=www-data
WorkingDirectory=/home/ubuntu/website/UniservedWebsite

ExecStart = /usr/local/bin/gunicorn --workers 2 --graceful-timeout 30 --bind 0.0.0.0:8134 UniservedWebsite.wsgi:application


[Install]
WantedBy=multi-user.target

Upvotes: 5

Views: 3177

Answers (1)

Sinandro
Sinandro

Reputation: 2646

Just create two .service file, and start them separately...

Upvotes: 6

Related Questions