如何运行多个Django App Gunicorn systemd?

问题描述 投票:4回答:1

我有两个django projects在相同的ec2 instance上运行在不同的端口上,我通过在gunicorn.service创建/etc/systemd/system/文件来配置gunicorn系统,如果我运行命令systemctl start gunicorn,它工作得很棒。现在我想运行另一个proect,我该如何配置它,目前我正在运行使用gunicorn命令/usr/local/bin/gunicorn --graceful-timeout 30 --bind 0.0.0.0:8690 projectFile.wsgi:application --daemon,我可以在gunicorn.service本身添加相同的。如何在gunicorn systemd中配置多个项目?

gunicorn.service文件 -

[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
django server gunicorn systemd
1个回答
4
投票

只需创建两个.service文件,然后单独启动它们......

© www.soinside.com 2019 - 2024. All rights reserved.