环境:
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 .安装IIS
5.安装CGI
6.将源码拷贝至【C:\inetpub\wwwroot\MySite】
( MySite是自定义文件夹,wwwroot是IIS默认网站存放的文件夹,为避免权限问题,不建议变动)
7.cmd 执行:pip install -r requirements
(安装依赖包)
8.cmd 执行:pip install wfastcgi
9 .cmd 执行:wfastcgi-enable
(获取脚本处理器信息,第8步需要使用)
【scriptProcessor】
结构:<Python安装路径>\python.exe|<Python安装路径>\lib\site-packages\wfastcgi.py
例如:【d:\programs\python\python.exe|d:\programs\python\lib\site-packages\wfastcgi.py】
7.打开IIS管理器添加网站,网站名称为【MySite】,物理路径为【C:\inetpub\wwwroot\MySite】,选择IP和端口
8.在【C:\inetpub\wwwroot\MySite】文件夹下添加文件【web.config】,内容如下(【】内是需要替换的部分):
<"1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="【d:\programs\python\python.exe|d:\programs\python\lib\site-packages\wfastcgi.py】" resourceType="Unspecified" requireAccess="Script"/> </handlers> </system.webServer> <appSettings> <add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" /> <add key="PYTHONPATH" value="【C:\inetpub\wwwroot\MySite】" /> <add key="DJANGO_SETTINGS_MODULE" value="【项目名.settings】" /> </appSettings> </configuration>
9.在网站【MySite】添加【static】虚拟目录
10.在【C:\inetpub\wwwroot\MySite\static】文件夹下添加文件【web.config】,内容如下:
<"1.0" encoding="UTF-8"?> <configuration> <system.webServer> <!-- this configuration overrides the FastCGI handler to let IIS serve the static files --> <handlers> <clear/> <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" /> </handlers> </system.webServer> </configuration>
11 .在网站【MySite】添加【media】虚拟目录
12.在【C:\inetpub\wwwroot\MySite\media】文件夹下添加文件【web.config】,内容如下:
<"1.0" encoding="UTF-8"?> <configuration> <system.webServer> <!-- this configuration overrides the FastCGI handler to let IIS serve the static files --> <handlers> <clear/> <add name="MediaFile" path="*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" /> </handlers> </system.webServer> </configuration>
权限相关的报错,执行如下三步:
13 .cmd 执行:%windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/handlers
14 .cmd 执行:%windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/modules
15.右键点击【MySite】,点击【编辑权限】,在【安全】选项卡里给IIS_IUSERS赋予【完全控制】的权限
总结
以上所述是小编给大家介绍的Django上线部署之IIS的配置方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
更新日志
- 华少翌.2005-华少翌【中唱艺能】【WAV+CUE】
- 群星《十二女声Ⅱ》[WAV/CUE/分轨][527MB]
- 大自然音乐系列《漫步在山裡》[WAV/CUE/分轨][502.8MB]
- 大自然音乐系列《星光夜语》[WAV/CUE/分轨][453.3MB]
- 史依弘《史依弘交响乐京剧演唱专辑HQ》头版限量编号[WAV+CUE]
- 曼丽2020《女人三十风继续吹》HQCD[WAV+CUE]
- 曼丽2021《女人三十2雾之恋》HQCD[WAV+CUE]
- 隔壁老樊.2019-我曾【好听音乐】【FLAC分轨】
- 高林生.1993-牵挂你的人是我【白天鹅】【WAV+CUE】
- 洪卓立.2012-找个懂我的女孩(国专)【英皇娱乐】【WAV+CUE】
- 曼丽2022《女人三十3晚秋》HQCD[WAV+CUE]
- 曼丽2018《女人三十4冬天》HQCD[WAV+CUE]
- 柏菲-《好歌30年壹》限量开盘母带ORMCD[低速原抓WAV+CUE]
- 大自然音乐系列《水舞》[WAV/CUE/分轨][424.3MB]
- 大自然音乐系列《星光夜语》[WAV/CUE/分轨][453.3MB]