環境:
Apache2.4 32bit
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32
Django 2.1.3
配置wsgi步驟:
pip install mod_wsgi-4.5.24+ap24vc14-cp37-cp37m-win32.whl
在venv下執行activate,啟用專案使用的虛擬環境。執行mod_wsgi-express.exe module-config,輸出下面的2行,複製到http.conf,並按如下設定,無需設定LoadFile "d:/python37-32/python37.dll"
LoadModule wsgi_module "d:/www/venv/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win32.pyd"
WSGIPythonHome "d:/www/venv"
Django專案中wsgi.py的路徑:
WSGIScriptAlias / D:/www/MxOnline/MxOnline/wsgi.py
Django專案的路徑,注意是專案的根目錄:
WSGIPythonPath D:/www/MxOnline/
配置wsgi.py的訪問許可權
<Files wsgi.py>
Require all granted
Alias /static "D:/www/MxOnline/static"
Require all granted