{"title":"Déploiement de Django avec Gunicorn","version":"5.2","locale":"fr","docname":"howto/deployment/wsgi/gunicorn","url":"/fr/5.2/howto/deployment/wsgi/gunicorn/","canonical":"https://djangodocs.dev/fr/5.2/howto/deployment/wsgi/gunicorn/","summary":"Gunicorn (« Green Unicorn ») est un serveur WSGI en pur Python pour UNIX. Il n’a aucune dépendance et peut être installé avec pip . Installation de Gunicorn Lien…","html":"<h1>Déploiement de Django avec Gunicorn<a class=\"heading-anchor\" href=\"#how-to-use-django-with-gunicorn\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><a class=\"reference external\" href=\"https://gunicorn.org/\">Gunicorn</a> (« Green Unicorn ») est un serveur WSGI en pur Python pour UNIX. Il n’a aucune dépendance et peut être installé avec <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code>.</p>\n<section id=\"installing-gunicorn\">\n<h2>Installation de Gunicorn<a class=\"heading-anchor\" href=\"#installing-gunicorn\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Installez gunicorn en exécutant <code class=\"docutils literal notranslate\"><span class=\"pre\">python</span> <span class=\"pre\">-m</span> <span class=\"pre\">pip</span> <span class=\"pre\">install</span> <span class=\"pre\">gunicorn</span></code>. Pour plus de détails, consultez la <a class=\"reference external\" href=\"https://docs.gunicorn.org/en/latest/install.html\">documentation de gunicorn</a>.</p>\n</section>\n<section id=\"running-django-in-gunicorn-as-a-generic-wsgi-application\">\n<h2>Django dans Gunicorn comme application WSGI générique<a class=\"heading-anchor\" href=\"#running-django-in-gunicorn-as-a-generic-wsgi-application\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Lorsque Gunicorn est installé, une commande <code class=\"docutils literal notranslate\"><span class=\"pre\">gunicorn</span></code> est disponible et permet de lancer le processus de serveur de Gunicorn. L’invocation la plus simple de gunicorn est de lui transmettre l’emplacement d’un module contenant un objet d’application WSGI nommé <code class=\"docutils literal notranslate\"><span class=\"pre\">application</span></code>, ce qui pour un projet Django typique devrait ressembler à ceci :</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>gunicorn<span class=\"w\"> </span>myproject.wsgi\n</code></pre></div>\n<p>Cela démarrera un processus utilisant un fil d’exécution écoutant sur <code class=\"docutils literal notranslate\"><span class=\"pre\">127.0.0.1:</span> <span class=\"pre\">8000</span></code>. Il faut que votre projet soit dans le chemin Python ; la façon la plus simple de s’en assurer est d’exécuter cette commande dans le même répertoire que votre fichier <code class=\"docutils literal notranslate\"><span class=\"pre\">manage.py</span></code>.</p>\n<p>Voir la <a class=\"reference external\" href=\"https://docs.gunicorn.org/en/latest/deploy.html\">documentation de déploiement</a> de Gunicorn pour obtenir des conseils supplémentaires.</p>\n</section>","rootId":"how-to-use-django-with-gunicorn","toc":[{"title":"Installation de Gunicorn","anchor":"installing-gunicorn","children":[]},{"title":"Django dans Gunicorn comme application WSGI générique","anchor":"running-django-in-gunicorn-as-a-generic-wsgi-application","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"Guides pratiques","url":"/fr/5.2/howto/"},{"docname":"howto/deployment/index","title":"Comment déployer Django","url":"/fr/5.2/howto/deployment/"},{"docname":"howto/deployment/wsgi/index","title":"Comment déployer avec WSGI","url":"/fr/5.2/howto/deployment/wsgi/"}],"prev":{"docname":"howto/deployment/wsgi/index","title":"Comment déployer avec WSGI","url":"/fr/5.2/howto/deployment/wsgi/"},"next":{"docname":"howto/deployment/wsgi/uwsgi","title":"Déploiement de Django avec uWSGI","url":"/fr/5.2/howto/deployment/wsgi/uwsgi/"},"formats":{"html":"/fr/5.2/howto/deployment/wsgi/gunicorn/","markdown":"/fr/5.2/howto/deployment/wsgi/gunicorn.md","json":"/fr/5.2/howto/deployment/wsgi/gunicorn.json"},"source":"https://github.com/django/django/blob/stable/5.2.x/docs/howto/deployment/wsgi/gunicorn.txt","official":"https://docs.djangoproject.com/fr/5.2/howto/deployment/wsgi/gunicorn/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}