环境:
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