{"title":"Déploiement de Django avec Gunicorn","version":"1.11","locale":"fr","docname":"howto/deployment/wsgi/gunicorn","url":"/fr/1.11/howto/deployment/wsgi/gunicorn/","canonical":"https://djangodocs.dev/fr/1.11/howto/deployment/wsgi/gunicorn/","summary":"Gunicorn (« Green Unicorn ») est un serveur WSGI en pur Python pour UNIX. Il n’a aucune dépendance et est simple d’installation et d’utilisation. Installation de…","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=\"http://gunicorn.org/\">Gunicorn</a> (« Green Unicorn ») est un serveur WSGI en pur Python pour UNIX. Il n’a aucune dépendance et est simple d’installation et d’utilisation.</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>L’installation de Gunicorn est aussi simple que <code class=\"docutils literal notranslate\"><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=\"http://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. Dans le cas le plus simple, gunicorn a juste besoin d’être appelé avec l’emplacement d’un module contenant un objet d’application WSGI nommé application. Donc, pour un projet Django typique, l’invocation de gunicorn ressemblerait à :</p>\n<div class=\"code-block\" data-language=\"bash\"><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=\"http://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/1.11/howto/"},{"docname":"howto/deployment/index","title":"Déploiement de Django","url":"/fr/1.11/howto/deployment/"},{"docname":"howto/deployment/wsgi/index","title":"Comment déployer avec WSGI","url":"/fr/1.11/howto/deployment/wsgi/"}],"prev":{"docname":"howto/deployment/wsgi/apache-auth","title":"Authentification sur la base de données des utilisateurs de Django depuis Apache","url":"/fr/1.11/howto/deployment/wsgi/apache-auth/"},"next":{"docname":"howto/deployment/wsgi/uwsgi","title":"Déploiement de Django avec uWSGI","url":"/fr/1.11/howto/deployment/wsgi/uwsgi/"},"formats":{"html":"/fr/1.11/howto/deployment/wsgi/gunicorn/","markdown":"/fr/1.11/howto/deployment/wsgi/gunicorn.md","json":"/fr/1.11/howto/deployment/wsgi/gunicorn.json"},"source":"https://github.com/django/django/blob/stable/1.11.x/docs/howto/deployment/wsgi/gunicorn.txt","official":"https://docs.djangoproject.com/fr/1.11/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","fr","ja","id","pt-br","ko","es","el","pl"]}