23
loading...
This website collects cookies to deliver better user experience
sudo apt-get install supervisor
sudo supervisorctl version
/etc/supervisor/conf.d/
on Linux, these files have the extension .conf
.cd /etc/supervisor/conf.d/
sudo touch gunicorn.conf
sudo nano gunicorn.conf
nano
i.e. a terminal based text editor, you can use vim or any other text editor of your choice.[program:gunicorn]
directory=/home/ubuntu/my-django-project/
command=/home/ubuntu/my-django-project/venv/bin/gunicorn --access-logfile - --log-level DEBUG --workers 4 --bind 127.0.0.1:8000 my-django-project.wsgi:application
autostart=true
autorestart=true
stderr_logfile=/home/ubuntu/my-django-project/logs/gunicorn/gunicorn.err.log
stdout_logfile=/home/ubuntu/my-django-project/logs/gunicorn/gunicorn.out.log
/home/ubuntu/my-django-project
with path to your django project and /home/ubuntu/my-django-project/venv/
with the path to your virtualenv. Now, if you notice there are two config at the end, stderr_logfile
and stdout_logfile
respectively, what they do is that define the path of the file where the error and output logs of the service should be saved, so be sure replace it with path where you want to save your logs.Tip : If you mention any non existing directories in your path, be sure to create them beforehand or else supervisor will fail to start our service.
sudo supervisorctl reload
sudo supervisorctl status