{"title":"Django を Gunicorn とともに使う","version":"6.0","locale":"ja","docname":"howto/deployment/wsgi/gunicorn","url":"/ja/6.0/howto/deployment/wsgi/gunicorn/","canonical":"https://djangodocs.dev/ja/6.0/howto/deployment/wsgi/gunicorn/","summary":"Gunicorn ('Green Unicorn') は UNIX 向けの pure-Python で実装されたWSGIサーバーです。依存はなく、 pip を使ってインストールできます。 Gunicornのインストール Link to this heading # python -m pip install gunicorn…","html":"<h1>Django を Gunicorn とともに使う<a class=\"heading-anchor\" href=\"#how-to-use-django-with-gunicorn\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p><a class=\"reference external\" href=\"https://gunicorn.org/\">Gunicorn</a> ('Green Unicorn') は UNIX 向けの pure-Python で実装されたWSGIサーバーです。依存はなく、 <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code> を使ってインストールできます。</p>\n<section id=\"installing-gunicorn\">\n<h2>Gunicornのインストール<a class=\"heading-anchor\" href=\"#installing-gunicorn\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p><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> を実行して gunicorn をインストールします。詳細は <a class=\"reference external\" href=\"https://gunicorn.org/\">gunicorn documentation</a> を参照してください。</p>\n</section>\n<section id=\"running-django-in-gunicorn-as-a-generic-wsgi-application\">\n<h2>GunicornでDjangoを一般的なWSGIアプリケーションとして動作させる<a class=\"heading-anchor\" href=\"#running-django-in-gunicorn-as-a-generic-wsgi-application\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Gunicorn がインストールされると、Gunicorn サーバプロセスを起動する <code class=\"docutils literal notranslate\"><span class=\"pre\">gunicorn</span></code> コマンドが利用できるようになります。gunicorn の最も単純な起動方法は、 <code class=\"docutils literal notranslate\"><span class=\"pre\">application</span></code> という WSGI アプリケーションオブジェクトを含むモジュールの場所を渡すことです 。典型的な Django プロジェクトでは次のようになります:</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>このコマンドは <code class=\"docutils literal notranslate\"><span class=\"pre\">127.0.0.1:8000</span></code> を待ち受ける1つのスレッドを実行する1つのプロセスを開始します。プロジェクトは Python のパス上に置く必要があります。最も簡単な方法は <code class=\"docutils literal notranslate\"><span class=\"pre\">manage.py</span></code> ファイルと同じディレクトリからこのコマンドを実行することです。</p>\n<p>その他のヒントについては、Gunicorn の <a class=\"reference external\" href=\"https://gunicorn.org/deploy/\">deployment documentation</a> を参照してください。</p>\n</section>","rootId":"how-to-use-django-with-gunicorn","toc":[{"title":"Gunicornのインストール","anchor":"installing-gunicorn","children":[]},{"title":"GunicornでDjangoを一般的なWSGIアプリケーションとして動作させる","anchor":"running-django-in-gunicorn-as-a-generic-wsgi-application","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"How-to ガイド","url":"/ja/6.0/howto/"},{"docname":"howto/deployment/index","title":"Djangoをデプロイするには","url":"/ja/6.0/howto/deployment/"},{"docname":"howto/deployment/wsgi/index","title":"WSGI とともにデプロイするには","url":"/ja/6.0/howto/deployment/wsgi/"}],"prev":{"docname":"howto/deployment/wsgi/index","title":"WSGI とともにデプロイするには","url":"/ja/6.0/howto/deployment/wsgi/"},"next":{"docname":"howto/deployment/wsgi/uwsgi","title":"Django を uWSGI とともに使うには？","url":"/ja/6.0/howto/deployment/wsgi/uwsgi/"},"formats":{"html":"/ja/6.0/howto/deployment/wsgi/gunicorn/","markdown":"/ja/6.0/howto/deployment/wsgi/gunicorn.md","json":"/ja/6.0/howto/deployment/wsgi/gunicorn.json"},"source":"https://github.com/django/django/blob/stable/6.0.x/docs/howto/deployment/wsgi/gunicorn.txt","official":"https://docs.djangoproject.com/ja/6.0/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"]}