1.编译apache的mod_wsgi 4.X扩展参考 参考 https://modwsgi.readthedocs.io/en/develop/user-guides/quick-installation-guide.html
安装mod_wsgi的时候需要指定python的执行文件路径。这样apache启动的时候就会启动指定版本的mod_wsgi、以及指定的python
版本。
2.windows环境部署参考https://blog.csdn.net/zhangtao0417/article/details/81564444
3.python应用对应的apache虚拟主机配置参考:
ServerName test.com
ServerAdmin [email protected]
DocumentRoot /var/www/html/test_wsgi_doc
Order allow,deny
Allow from all
= 2.4>
Require all granted
WSGIDaemonProcess test.com processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup test.com
LogLevel info
#WSGIScriptAlias / /var/www/html/test_wsgi/myapp.wsgi
WSGIScriptAlias / /var/www/html/doc_app/my_application.wsgi
#
Order allow,deny
Allow from all
= 2.4>
Require all granted
其中my_application.wsgi的写法参考如下:
import sys
sys.path.insert(0, '/var/www/html/应用路径')
#第一个app是app.py, 这个文件里面引入了flask的一个对象app
from app import app as application
4.mod_wsgi 快速上手参考https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html