django apache mod_wsgi 发布

配置文件真的挺简单,如下即可,只是要编译apache,apr,apr-utils,libpcre,mod_wsgi等,ubuntu17.10下的apache2安装包不能用,自己编译的apache2安装在/usr/local/apache2,配置文件日志文件等都在这一文件夹内

LoadModule wsgi_module modules/mod_wsgi.so

WSGIScriptAlias / /home/mhq/web/parts/mysite/wsgi.py
WSGIPythonPath /home/mhq/web/parts
<Directory /home/mhq/web/parts/mysite>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

在windows 系统下,根据mod_wsgi帮助文件中如下提示:If you are running Windows, it is recommended you use the Apache distribution from Apache Lounge (www.apachelounge.com). Other Apache distributions for Windows aren't always complete and are missing the files needed to compile additional Apache modules.下载该网站的apache.设置Apache环境变量后本机的VS2015顺利编译安装mod_wsgi。

set MOD_WSGI_APACHE_ROOTDIR=d:\apache24
d:\python36-32\python setup.py install

Apache配置文件增加如下内容:

LoadFile "d:/python36-32/python36.dll"
LoadModule wsgi_module "d:/python36-32/lib/site-packages/mod_wsgi-4.6.4-py3.6-win32.egg/mod_wsgi/server/mod_wsgi.cp36-win32.pyd"
WSGIPythonHome "d:/python36-32"
WSGIScriptAlias / "d:/parts/mysite/wsgi.py"
WSGIPythonPath d:/parts
<Directory d:/parts/mysite>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>


猜你喜欢

转载自blog.csdn.net/mahongquan/article/details/79047968