-
Mémo Configuration de Gunicorn
Le passe-plats Python
Gunicorn (Green Unicorn) est un serveur Web HTTP WSGI écrit en Python, servant très bien les applications Django. Il fait le lien entre le programme écrit en Python et le serveur HTTP, Nginx par exemple.
Dans /etc/systemd/system/ créer le fichier gunicorn.service.
[Unit] Description=gunicorn daemon Requires=gunicorn.sock After=network.target [Service] User=myuser Group=www-data WorkingDirectory=/srv/<appdir> ExecStart=/opt/venv/bin/gunicorn \ --workers 3 \ --log-level debug \ --access-logfile /var/log/<appdir>/gunicorn.access.log \ --error-logfile /var/log/<appdir>/gunicorn.error.log \ --bind unix:/run/gunicorn/sock \ config.wsgi:application [Install] WantedBy=multi-user.target
Le fichier de configuration a été modifié.
$ sudo systemctl daemon-reload $ sudo systemctl enable gunicorn $ sudo systemctl restart gunicorn