Django上线部署之Apache
环境:
1.windows server 2016 datacenter 64位
2.sql server 2016 enterprise 64位
3.python 3.6.0 64位
4.administrator用户,无域环境,最高权限
要求:
按照顺序部署
1.安装数据库
2.安装数据库客户端【ssms】
3.安装python
4.下载apache2.4(httpd-2.4.41-win64-vc14.zip )
5.解压至c盘根目录,打开cmd执行:c:\apache24\bin\httpd.exe -k install
6.下载编译后的wsgi()
7.cmd执行:pip install 【路径】\mod_wsgi-4.5.24+ap24vc14-cp36-cp36m-win_amd64.whl
8.cmd执行:mod_wsgi-express module-config(执行结果追加到【httpd.conf】)
loadfile "d:/programs/python/python36.dll"
loadmodule wsgi_module "d:/programs/python/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
wsgipythonhome "d:/programs/python"
9.修改【httpd.conf】
define srvroot "c:/apache24"
servername 【ip】:80
include conf/extra/httpd-vhosts.conf(取消注释)
10.修改【extra/httpd-vhosts.conf】,如下:
<virtualhost *:80>
servername "192.168.70.111"
documentroot "${srvroot}/htdocs/mysite"
errorlog "logs/project-error.log"
customlog "logs/project-access.log" common
</virtualhost>
alias /media/ "${srvroot}/htdocs/mysite/media/"
<directory "${srvroot}/htdocs/mysite/media/">
require all granted
</directory>
alias /static/ "${srvroot}/htdocs/mysite/static/"
<directory "${srvroot}/htdocs/mysite/static/">
require all granted
</directory>
wsgiscriptalias / "${srvroot}/htdocs/mysite/project/wsgi.py"
<directory "${srvroot}/htdocs/mysite/project/">
<files wsgi.py>
require all granted
</files>
</directory>
11.启动c:\apache24\bin\apachemonitor.exe
推荐阅读
-
Django上线部署之Apache
-
Django上线部署之IIS
-
Python3+django2.0+apache2+ubuntu14部署网站上线的方法
-
Apache上部署Django步骤详细介绍
-
在Linux系统上部署Apache+Python+Django+MySQL环境
-
Linux下将Python的Django项目部署到Apache服务器
-
Django上线部署之Apache的方法
-
windows64位下用apache2.4.29部署django1.11.7项目并使在局域网内可访问(mod_wsgi.so可下载)--超详细
-
Windows+apache+mod_wsgi部署Django项目
-
Django学习路线之将项目部署到阿里云服务器