差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
| python:gunicorn [2020/04/25 08:43] – [インストール] ともやん | python:gunicorn [2020/09/11 17:25] (現在) – ともやん | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | < | ||
| - | < | ||
| - | #result pre { | ||
| - | overflow: scroll; | ||
| - | overflow-x: hidden; | ||
| - | font-size: 10px; | ||
| - | } | ||
| - | # | ||
| - | height: 400px; | ||
| - | overflow: scroll; | ||
| - | overflow-x: hidden; | ||
| - | font-size: 10px; | ||
| - | } | ||
| - | #logo { | ||
| - | background-color: | ||
| - | padding: 15px; | ||
| - | } | ||
| - | #logo p { | ||
| - | margin: 0; | ||
| - | } | ||
| - | .dokuwiki .plugin_wrap { | ||
| - | width: fit-content; | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| ====== Gunicorn - Python WSGI HTTP Server for UNIX ====== | ====== Gunicorn - Python WSGI HTTP Server for UNIX ====== | ||
| <WRAP #logo> | <WRAP #logo> | ||
| 行 29: | 行 4: | ||
| </ | </ | ||
| 本家: [[https:// | 本家: [[https:// | ||
| + | ドキュメント: | ||
| ソースコード: | ソースコード: | ||
| 行 89: | 行 65: | ||
| </ | </ | ||
| + | ==== gunicorn 動作確認 ==== | ||
| + | Python バージョン確認\\ | ||
| + | < | ||
| + | $ python -VV | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Python 3.7.6 (default, Jan 30 2020, 09:44:41) | ||
| + | [GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Python 仮想環境の作成\\ | ||
| + | < | ||
| + | $ python -m venv py3dj3_venv | ||
| + | </ | ||
| + | |||
| + | Python 仮想環境の有効化\\ | ||
| + | < | ||
| + | $ . py3dj3_venv/ | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | (py3dj3_venv) $ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Python 仮想環境の pip を更新\\ | ||
| + | < | ||
| + | (py3dj3_venv) $ python -m pip install --upgrade pip | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Collecting pip | ||
| + | Using cached https:// | ||
| + | Installing collected packages: pip | ||
| + | Found existing installation: | ||
| + | Uninstalling pip-19.1.1: | ||
| + | Successfully uninstalled pip-19.1.1 | ||
| + | Successfully installed pip-20.0.2 | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **Django** のインストール\\ | ||
| + | < | ||
| + | (py3dj3_venv) $ pip install django | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Collecting django | ||
| + | Using cached Django-3.0.5-py3-none-any.whl (7.5 MB) | ||
| + | Collecting sqlparse> | ||
| + | Using cached sqlparse-0.3.1-py2.py3-none-any.whl (40 kB) | ||
| + | Collecting pytz | ||
| + | Using cached pytz-2019.3-py2.py3-none-any.whl (509 kB) | ||
| + | Collecting asgiref~=3.2 | ||
| + | Using cached asgiref-3.2.7-py2.py3-none-any.whl (19 kB) | ||
| + | Installing collected packages: sqlparse, pytz, asgiref, django | ||
| + | Successfully installed asgiref-3.2.7 django-3.0.5 pytz-2019.3 sqlparse-0.3.1 | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **Gunicorn** のインストール\\ | ||
| + | < | ||
| + | (py3dj3_venv) $ pip install gunicorn | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Collecting gunicorn | ||
| + | Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB) | ||
| + | | ||
| + | Requirement already satisfied: setuptools> | ||
| + | Installing collected packages: gunicorn | ||
| + | Successfully installed gunicorn-20.0.4 | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Django プロジェクトの作成\\ | ||
| + | < | ||
| + | (py3dj3_venv) $ django-admin startproject django_project | ||
| + | </ | ||
| + | |||
| + | Python 仮想環境の終了\\ | ||
| + | < | ||
| + | (py3dj3_venv) $ deactivate | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | $ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | 一番シンプルな gunicorn コマンドで Django アプリの動作確認を行う\\ | ||
| + | <WRAP prewrap 100%> | ||
| + | < | ||
| + | $ py3dj3_venv/ | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | [2020-04-25 09:25:36 +0900] [289] [INFO] Starting gunicorn 20.0.4 | ||
| + | [2020-04-25 09:25:36 +0900] [289] [INFO] Listening at: http:// | ||
| + | [2020-04-25 09:25:36 +0900] [289] [INFO] Using worker: sync | ||
| + | [2020-04-25 09:25:36 +0900] [292] [INFO] Booting worker with pid: 292 | ||
| + | </ | ||
| + | </ | ||
| + | ※Python 仮想環境の Gunicorn を実行すると、仮想環境のパッケージを利用できる。\\ | ||
| + | |||
| + | [[http:// | ||
| + | {{: | ||
| + | |||
| + | gunicorn コマンドを **Ctrl + C** で終了\\ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Not Found: / | ||
| + | Not Found: / | ||
| + | [2020-04-25 15:34:28 +0900] [289] [CRITICAL] WORKER TIMEOUT (pid:292) | ||
| + | [2020-04-25 06:34:28 +0000] [292] [INFO] Worker exiting (pid: 292) | ||
| + | [2020-04-25 15:34:28 +0900] [321] [INFO] Booting worker with pid: 321 | ||
| + | ^C <- Ctrl + C を入力 | ||
| + | [2020-04-25 15:45:53 +0900] [289] [INFO] Handling signal: int | ||
| + | [2020-04-25 06:45:53 +0000] [321] [INFO] Worker exiting (pid: 321) | ||
| + | [2020-04-25 15:45:53 +0900] [289] [INFO] Shutting down: Master | ||
| + | $ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== 参考文献 ===== | ||
| + | [[https:// | ||
| + | <ifauth @dokuwikiusers> | ||
| + | [[system_manage: | ||
| + | </ | ||