Django上线部署之Apache的方法

发布时间:2022-04-22 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了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(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的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本宝典网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

脚本宝典总结

以上是脚本宝典为你收集整理的Django上线部署之Apache的方法全部内容,希望文章能够帮你解决Django上线部署之Apache的方法所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:django