windows 10 部署flask web
起因
本来想这用django 写一个web 应用程序,便于管理mongodb的数据。结果django 不直接支持mongodb……又没时间研究NoSQL。于是想着随便整个api吧……
于是先用flask 做个简单的demo 部署到本地试试水
简单的demo
from flask import Flask, jsonify app = Flask(__name__)
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
},
{
'id': 2,
'title': u'Learn Python',
'description': u'Need to find a good Python tutorial on the web',
'done': False
}
] @app.route('/')
def hello_world():
return jsonify({'task':tasks}) if __name__ == '__main__':
app.run()
走进部署之坑
网上五花八门的部署blog……各种转载…… http://python.jobbole.com/87655/ 借鉴一下吧
- 安装IIS
- 启用CGI
- 安装Microsoft Web Platform Installer
- 添加 url 重写(URL Rewrite)和IIS(CGI)
- 安装 wfastcgi (pip install wfastcgi)
- 启用 wfastcgi

- 创建web.config
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers>
<!-- name 和 path 都是项目名 ;scriptProcessor 就是上面启动wfastcgi 的返回信息(如上图,画线部分)-->
<add name="DMApi" path="DMApi" verb="*" modules="FastCgiModule" scriptProcessor="e:\demo\flask\dmapi\venv\scripts\python36.exe|e:\demo\flask\dmapi\venv\lib\site-packages\wfastcgi.py" resourceType="File" /> <!-- scriptProcessor 的值来自命令行工具 wfastcgi-enable --> <add name="FlaskFastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="e:\demo\flask\dmapi\venv\scripts\python36.exe|e:\demo\flask\dmapi\venv\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" /> </handlers> <security> <!-- URL 重写中的特殊字符,比如加号+等等 --> <requestFiltering allowDoubleEscaping="true"></requestFiltering> </security> </system.webServer> <appSettings> <!-- Required settings --> <!-- 在这里指定Falsk app在模块中的具体位置 --> <add key="WSGI_HANDLER" value="DMApi.app" /> <add key="PYTHONPATH" value="~/" /> <!-- Optional settings --> <!-- 需要先创建日志目录,否则报错 --> <add key="WSGI_LOG" value="F:\\Demo\\flask\\DMApi\\logs\\web.log" /> <add key="WSGI_RESTART_FILE_REGEX" value="" /> </appSettings> </configuration> - 配置IIS 目录及权限
- 创建网站
访问掉坑
人家教程里写的好好的 “hello ……”
而我却是这样的
Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
是这样的……

结果
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
Add Application Development from the Features! Remember to add the 4.5 stuff if you need it
终于看到了结果……

windows 10 部署flask web的更多相关文章
- Ubuntu16.04采用FastCGI方式部署Flask web框架
1 部署nginx 1.1 安装nginx服务 root@desktop:~# apt-get install nginx -y 1.2 验证nginx服务是否启动 root@des ...
- 如何使用Nginx和uWSGI或Gunicorn在Ubuntu上部署Flask Web应用
你好!欢迎阅读我的博文,你可以跳转到我的个人博客网站,会有更好的排版效果和功能. 此外,本篇博文为本人Pushy原创,如需转载请注明出处:https://pushy.site/posts/151981 ...
- Windows 10 部署Enterprise Solution 5.5
Windows 10正式版发布以后,新操作系统带来了许多的变化.现在新购买的电脑安装的系统应该是Windows 10.与当初用户不习惯Windows 7,购买新电脑后第一个想做的事情就是重装成XP,估 ...
- Windows 10部署教程
1. 获取主板密钥 在powershell中执行: (Get-WmiObject -query 'select * from softwareLicensingService').OA3xOrigin ...
- 腾讯云Unubtu 16.04 (gunicorn+supervisor+ngnix+mongodb)部署Flask应用
1.申请腾讯云服务 我申请了免费使用的云服务器 ,选择安装的Linux版本是ubuntu16.04.1 LTSx86_64.我个人PC安装使用的也是这个版本,比较熟悉些. 详细参考帮助文档. 2.登录 ...
- [IOT] - Raspberry Pi 3B + Windows 10 IOT Core + .Net Core Web 部署
硬件:Raspberry Pi 3B 系统:Windows 10 IOT Core 应用:.Net Core Web 部署流程 1. 系统安装 1.1 下载并安装 Windows 10 IoT Cor ...
- 张高兴的 Windows 10 IoT 开发笔记:部署 ASP.NET Core 2 应用
今天是大年初二,都去走亲戚了吧,享受一下这难得的能和亲友相聚的时光.而我就不一样了,今天一回到家就又开始瞎折腾了,哈哈哈. 问题背景 最近花了点时间用 ASP.NET Core 2 写了个个人博客,中 ...
- 阿里云服务器Windows Server 2008/2012部署Office Web Server 2013
以前成功将Office Web Server 2013部署在了本地服务器上,此次是将Office Web Server 2013部署在阿里云服务器Windows Server 2008和2012上,中 ...
- windows 10开启bash on windows,配置sshd,部署hadoop
1.安装Bash on Windows 这个参考官网步骤,很容易安装,https://msdn.microsoft.com/en-us/commandline/wsl/install_guide 安装 ...
随机推荐
- poj 1966(顶点连通度)
题意:给出一个n个节点和m条边的图,求该图的顶点连通度. 分析: 顶点连通度的求解可以转换为网络最大流问题. (1)原图G中的每个顶点v变成网络中的两个顶点v‘和v’‘,顶点v’至v''有一个条弧(有 ...
- 用JavaScript添加选择按钮的背景颜色和juqery添加选择按钮的背景色
在项目开发中经常遇到要选择的按钮,选择完之后被选择的按钮的背景色会发生变化,表示被选择 样式图如下: 每点击一个数字,相应的背景色变为蓝色,其他的依旧是白色,先用JavaScript实现 html代码 ...
- Android Apollo MQTT入门
一.Apache Apollo服务器其实是一个消息中转站 下载地址 http://activemq.apache.org/apollo/download.html 服务搭建方式,参看博客Android ...
- python 求两个时间差
def timeInterval(self): today = datetime.date.today() print today modifiedTime = os.stat(filename).s ...
- oracle 空表导出dmp会报错
步骤一.查找出来的语句全部复制并执行 select 'analyze table '||table_name||' compute statistics;' from user_tables; 步骤二 ...
- Swift中使用MPMoviePlayerController实现自定义视频播放器界面
默认情况下播放器自带各种控制按钮,比如前进后退播放暂停等: var url = NSBundle.mainBundle().URLForResource("1", withExte ...
- Mybatis笔记六:Mybatis中SqlSessionFactoryBuilder/SqlSessionFactory/SqlSession/映射器实例的作用域(Scope)和生命周期
SqlSessionFactoryBuilder 这个类可以被实例化.使用和丢弃,一旦创建了 SqlSessionFactory,就不再需要它了.因此 SqlSessionFactoryBuilder ...
- 用C语言获取任意文件的长度(可能大于2GB)#define _FILE_OFFSET_BITS 64
打开文件后用 fseek() 函数把文件位置指针移动到文件的末尾,用 ftell() 获得这时位置指针距文件头的字节数,这个字节数就是文件的长度.但是这样做也会受到下面的限制:ftell() 函数的返 ...
- 加快android studio 编译速度
工程build一次太慢 经过各种搜索 整合以下 仅供参考 1.在下列目录中新建 gradle.properties 文件 /home//.gradle/ (Linux) /Users//.gradl ...
- Webpack 配置示例
Webpack 作为前端构建工具,对于大型网站开发,大大提升了开发效率.要使用webpack需要先安装webpack工具: 先来看一个最简单的命令 $ webpack main.js bundle.j ...