Index ソフト・ハード | WSGIタスク |
機能・要件 構成・方式 タスク Apache 単一プロセス デーモンモード 複数プロジェクト 導入 |
Apache (mod_wsgi) ・/etc/httpd/conf.modules.d/10-wsgi-python3.conf (設定例)
# mod_wsgi_python3はmod_wsgi(python2用)と同じApacheプロセスに共存できない。
# mod_wsgi(python2用)が未だロードされていない場合にのみロードする。
<IfModule !wsgi_module>
LoadModule wsgi_module modules/mod_wsgi_python3.so
</IfModule>
WSGIScriptAlias / /xxxx/xxxx/mysite.net/mysite/wsgi.py
#WSGIPythonHome /xxxx/xxxx/venv
WSGIPythonPath /xxxx/xxxx/mysite.net
Alias /static/ /xxxx/xxxx/mysite.net/static/
<Directory /xxxx/xxxx/mysite.net/static/>
Require all granted
</Directory>
<Directory /xxxx/xxxx/mysite.net/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
単一のmod_wsgiプロセスで複数のDjangoサイトを実行 ・wsgi.py 内のコードを変更又は、mod_wsgiのデーモンモードを使用 ・wsgi.py 内のコードを変更 os.environ.setdefault → os.environApacheをデーモンモードで使用 (複数のプロジェクトの設定例) ・デーモンモードを使用する場合、WSGIPythonPath を使用できない。 ・適切な「WSGIDaemonProcess」と「WSGIProcessGroup」ディレクティブを追加 「WSGIDaemonProcess」に python-path オプションを使用する。・Python と Django は仮想環境を使用する。
<IfModule !wsgi_module>
LoadModule wsgi_module modules/mod_wsgi_python3.so
</IfModule>
WSGIDaemonProcess project01 python-path=/home/xxxx/project01:\
/home/xxxx/venv/lib/python3.6/site-packages/ user=xxxx group=xxxx maximum-requests=10000
WSGIScriptAlias /project01 /home/xxxx/project01/config/wsgi.py process-group=xxxx
<Location /project01>
WSGIProcessGroup project01
</Location>
Alias /static/ /usr/local/project01/static/
<Directory /usr/local/project01/static/>
Require all granted
</Directory>
<Directory /home/xxxx/project01/config>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
・・・・
|
All Rights Reserved. Copyright (C) ITCL |