python:gunicorn

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
python:gunicorn [2020/04/25 08:19] – 作成 ともやんpython:gunicorn [2020/09/11 17:25] (現在) ともやん
行 1: 行 1:
-<html> 
-  <style> 
-    #logo { 
-      background-color: white; 
-      padding: 15px; 
-    } 
-    #logo p { 
-      margin: 0; 
-    } 
-    .dokuwiki .plugin_wrap { 
-      width: fit-content; 
-    } 
-  </style> 
-</html> 
 ====== Gunicorn - Python WSGI HTTP Server for UNIX ====== ====== Gunicorn - Python WSGI HTTP Server for UNIX ======
 <WRAP #logo> <WRAP #logo>
行 18: 行 4:
 </WRAP> </WRAP>
 本家: [[https://gunicorn.org/|Gunicorn - Python WSGI HTTP Server for UNIX]]\\ 本家: [[https://gunicorn.org/|Gunicorn - Python WSGI HTTP Server for UNIX]]\\
 +ドキュメント: [[http://docs.gunicorn.org/en/latest/index.html|Gunicorn - WSGI server — Gunicorn 20.0.4 documentation]]\\
 ソースコード: [[https://github.com/benoitc/gunicorn|benoitc/gunicorn: gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and sleepy applications.]]\\ ソースコード: [[https://github.com/benoitc/gunicorn|benoitc/gunicorn: gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and sleepy applications.]]\\
  
行 25: 行 12:
 $ sudo dnf install python3-gunicorn $ sudo dnf install python3-gunicorn
 </code> </code>
 +<WRAP prewrap 100% #result_long>
 +<code>
 +メタデータの期限切れの最終確認: 0:01:18 時間前の 2020年04月25日 08時25分04秒 に実施しました。
 +依存関係が解決しました。
 +=====================================================================================
 + Package                  Architecture   Version                Repository      Size
 +=====================================================================================
 +インストール:
 + python3-gunicorn         noarch         19.9.0-5.fc31          fedora         208 k
 +
 +トランザクションの概要
 +=====================================================================================
 +インストール  1 パッケージ
 +
 +合計サイズ: 208 k
 +インストール済みのサイズ: 779 k
 +これでよろしいですか? [y/N]: y
 +パッケージのダウンロード:
 +[SKIPPED] python3-gunicorn-19.9.0-5.fc31.noarch.rpm: Already downloaded
 +-------------------------------------------------------------------------------------
 +合計                                                  20 MB/s | 208 kB     00:00
 +トランザクションの確認を実行中
 +トランザクションの確認に成功しました。
 +トランザクションのテストを実行中
 +トランザクションのテストに成功しました。
 +トランザクションを実行中
 +  準備             :                                                             1/1
 +  インストール中   : python3-gunicorn-19.9.0-5.fc31.noarch                       1/1
 +  scriptletの実行中: python3-gunicorn-19.9.0-5.fc31.noarch                       1/1
 +  検証             : python3-gunicorn-19.9.0-5.fc31.noarch                       1/1
 +
 +インストール済み:
 +  python3-gunicorn-19.9.0-5.fc31.noarch
 +
 +完了しました!
 +</code>
 +</WRAP>
 +
 +**pip** によるインストール。\\
 +<code>
 +$ pip install gunicorn
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +Collecting gunicorn
 +  Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
 +     |████████████████████████████████| 77 kB 412 kB/s
 +Requirement already satisfied: setuptools>=3.0 in ./py3dj3_venv/lib/python3.7/site-packages (from gunicorn) (41.6.0)
 +Installing collected packages: gunicorn
 +Successfully installed gunicorn-20.0.4
 +</code>
 +</WRAP>
 +
 +==== gunicorn 動作確認 ====
 +Python バージョン確認\\
 +<code>
 +$ python -VV
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +Python 3.7.6 (default, Jan 30 2020, 09:44:41)
 +[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
 +</code>
 +</WRAP>
 +
 +Python 仮想環境の作成\\
 +<code>
 +$ python -m venv py3dj3_venv
 +</code>
 +
 +Python 仮想環境の有効化\\
 +<code>
 +$ . py3dj3_venv/bin/activate
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +(py3dj3_venv) $
 +</code>
 +</WRAP>
 +
 +Python 仮想環境の pip を更新\\
 +<code>
 +(py3dj3_venv) $ python -m pip install --upgrade pip
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +Collecting pip
 +  Using cached https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl
 +Installing collected packages: pip
 +  Found existing installation: pip 19.1.1
 +    Uninstalling pip-19.1.1:
 +      Successfully uninstalled pip-19.1.1
 +Successfully installed pip-20.0.2
 +</code>
 +</WRAP>
 +
 +**Django** のインストール\\
 +<code>
 +(py3dj3_venv) $ pip install django
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +Collecting django
 +  Using cached Django-3.0.5-py3-none-any.whl (7.5 MB)
 +Collecting sqlparse>=0.2.2
 +  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
 +</code>
 +</WRAP>
 +
 +**Gunicorn** のインストール\\
 +<code>
 +(py3dj3_venv) $ pip install gunicorn
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +Collecting gunicorn
 +  Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
 +     |████████████████████████████████| 77 kB 412 kB/s
 +Requirement already satisfied: setuptools>=3.0 in ./py3dj3_venv/lib/python3.7/site-packages (from gunicorn) (41.6.0)
 +Installing collected packages: gunicorn
 +Successfully installed gunicorn-20.0.4
 +</code>
 +</WRAP>
 +
 +Django プロジェクトの作成\\
 +<code>
 +(py3dj3_venv) $ django-admin startproject django_project
 +</code>
 +
 +Python 仮想環境の終了\\
 +<code>
 +(py3dj3_venv) $ deactivate
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +$
 +</code>
 +</WRAP>
 +
 +一番シンプルな gunicorn コマンドで Django アプリの動作確認を行う\\
 +<WRAP prewrap 100%>
 +<code>
 +$ py3dj3_venv/bin/gunicorn --bind :8000 --chdir /home/tomoyan/django_project django_project.wsgi
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 +<code>
 +[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://0.0.0.0:8000 (289)
 +[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
 +</code>
 +</WRAP>
 +※Python 仮想環境の Gunicorn を実行すると、仮想環境のパッケージを利用できる。\\
 +
 +[[http://localhost:8000|]] にブラウザでアクセスする。\\
 +{{:python:uwsgi_django_operation_check_001.png?600|Gunicorn Django Operation Check}}\\
 +
 +gunicorn コマンドを **Ctrl + C** で終了\\
 +<WRAP prewrap 100% #result>
 +<code>
 +Not Found: /static/admin/css/fonts.css
 +Not Found: /favicon.ico
 +[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
 +$
 +</code>
 +</WRAP>
 +
 +===== 参考文献 =====
 +[[https://gunicorn.org/#docs|Gunicorn - Python WSGI HTTP Server for UNIX - Documentation]]\\
 +<ifauth @dokuwikiusers>
 +[[system_manage:monsters_garage_servers:skv009_tuning|9号機チューニング]] (内部)\\
 +</ifauth>
  
  • python/gunicorn.1587770381.txt.gz
  • 最終更新: 2020/04/25 08:19
  • by ともやん