Django上线部署之Apache的方法
程序员文章站
2022-04-19 10:02:10
环境:
1.windows server 2016 datacenter 64位
2.sql server 2016 enterprise 64位
3.p...
环境:
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(mod_wsgi-4.5.24+ap24vc14-cp36-cp36m-win_amd64.whl)
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的方法,希望对大家有所帮助
推荐阅读