windows IIS部署python Flask 网站

安装IIS,启用CGI

安装Anaconda

我一般机器都安装Anaconda,虽然比较大, 但是管理python版本以及包会很方便。

安装wfastcgi并激活

打开Anaconda Prompt。


进入python安装目录下的scripts文件夹然后运行wfastcgi-enable

打开"处理程序映射"模块,添加映射模块

     

web.config文件如下:

其中“mypythontest.app”,为python项目中

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="FlaskFastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\ProgramData\Anaconda3\python.exe|c:\ProgramData\anaconda3\lib\site-packages\wfastcgi.py" resourceType="Unspecified" />
        </handlers>
    </system.webServer>
	<appSettings>
		<!-- Required settings -->
		<add key="WSGI_HANDLER" value="mypythontest.app" />
		<add key="PYTHONPATH" value="C:\ProgramData\Anaconda3" />
	</appSettings>
</configuration>

猜你喜欢

转载自blog.csdn.net/enter89/article/details/84999414
今日推荐