flask+mod_wsgi+apache在windows上的布署

已经安装过python3.5

1、安装flask:

pip install flask

2、安装apache:

Apache是开源软件,针对windows环境,它不直接提供编译版本。
可以在http://www.apachelounge.com/download/ 下载适合自己环境的版本。
根据我自己当前的环境,我选择的是Win32 VC10编译出来的Apache2.4版本
将压缩包下载到本机,然后将压缩包里面的Apache24文件夹拷贝到C:\。
当然,你可以拷贝到你的系统的任何位置,但Apache的默认配置是C:\Apache24。

如果你本机运行了IIS,将其关掉。因为IIS和Apache都默认用的是80端口。如果你想配置其它端口,我相信那也不难。等把Flask部署成功后再来捣鼓吧。
以管理员打开cmd:
>cd c:\
>cd Apache24\bin\

httpd -k install -n "Apache2.4" 

httpd -k start

如:

启动apache遇到错误:httpd: Could not reliably determine the server's fully qualified domain name

编辑httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80

3、安装mod_wsgi

pip install mod_wsgi

如:报错 error: Unable to find vcvarsall.bat

对于python,3.4 安装Windows SDK for Windows 7 and .NET 4.0(或者 Visual Studio 2010) 。对其他版本,连接:

https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/

 

posted @ 2018-06-24 16:53  阿锋佬  阅读(535)  评论(0编辑  收藏  举报