起因

本来想这用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

解决方案就是安装一下asp.net……

终于看到了结果……

windows 10 部署flask web的更多相关文章

  1. Ubuntu16.04采用FastCGI方式部署Flask web框架

    1    部署nginx 1.1    安装nginx服务 root@desktop:~# apt-get install nginx -y 1.2    验证nginx服务是否启动 root@des ...

  2. 如何使用Nginx和uWSGI或Gunicorn在Ubuntu上部署Flask Web应用

    你好!欢迎阅读我的博文,你可以跳转到我的个人博客网站,会有更好的排版效果和功能. 此外,本篇博文为本人Pushy原创,如需转载请注明出处:https://pushy.site/posts/151981 ...

  3. Windows 10 部署Enterprise Solution 5.5

    Windows 10正式版发布以后,新操作系统带来了许多的变化.现在新购买的电脑安装的系统应该是Windows 10.与当初用户不习惯Windows 7,购买新电脑后第一个想做的事情就是重装成XP,估 ...

  4. Windows 10部署教程

    1. 获取主板密钥 在powershell中执行: (Get-WmiObject -query 'select * from softwareLicensingService').OA3xOrigin ...

  5. 腾讯云Unubtu 16.04 (gunicorn+supervisor+ngnix+mongodb)部署Flask应用

    1.申请腾讯云服务 我申请了免费使用的云服务器 ,选择安装的Linux版本是ubuntu16.04.1 LTSx86_64.我个人PC安装使用的也是这个版本,比较熟悉些. 详细参考帮助文档. 2.登录 ...

  6. [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 ...

  7. 张高兴的 Windows 10 IoT 开发笔记:部署 ASP.NET Core 2 应用

    今天是大年初二,都去走亲戚了吧,享受一下这难得的能和亲友相聚的时光.而我就不一样了,今天一回到家就又开始瞎折腾了,哈哈哈. 问题背景 最近花了点时间用 ASP.NET Core 2 写了个个人博客,中 ...

  8. 阿里云服务器Windows Server 2008/2012部署Office Web Server 2013

    以前成功将Office Web Server 2013部署在了本地服务器上,此次是将Office Web Server 2013部署在阿里云服务器Windows Server 2008和2012上,中 ...

  9. windows 10开启bash on windows,配置sshd,部署hadoop

    1.安装Bash on Windows 这个参考官网步骤,很容易安装,https://msdn.microsoft.com/en-us/commandline/wsl/install_guide 安装 ...

随机推荐

  1. Windows系统下Log4Net+FileBeat+ELK日志分析系统问题总结

    问题如下:1.FileBeat日志报 "dial tcp 127.0.0.1:5544: connectex: No connection could be made because the ...

  2. 第214天:Angular 基础概念

    一.Angular 简介 1. 什么是 AngularJS - 一款非常优秀的前端高级 JS 框架 - 最早由 Misko Hevery 等人创建 - 2009 年被 Google 公式收购,用于其多 ...

  3. 在 Linux服务器中安装 Python 3.6

    一.服务器环境配置 在 CentOS 7 中安装 Python 之前,请确保系统中已经有了所有必要的开发依赖: # yum -y groupinstall development # yum -y i ...

  4. Java应用中使用ShutdownHook友好地清理现场

    在线上Java程序中经常遇到进程程挂掉,一些状态没有正确的保存下来,这时候就需要在JVM关掉的时候执行一些清理现场的代码.Java中得ShutdownHook提供了比较好的方案. JDK在1.3之后提 ...

  5. 导入eclipse工程到Android Studio中

    ref:从 Eclipse 迁移至 Android Studio | Android Studiohttps://developer.android.com/studio/intro/migrate. ...

  6. 【arc102E】Stop. Otherwise...

    Portal --> arc102E Description 有\(N\)个位置,每个位置可以填一个\(1\sim K\)的数,要求对于每一个\(i\in [2,2K]\),求出任意两个位置的和 ...

  7. (一)C的编译,printf,规范化

    (一)编译的具体过程: 以前一直觉得,C代码的具体实现过程就是把几个.c文件编译成.o文件,然后链接在一起就可以了.可是最近在看C Prime Plus查漏补缺基础知识的过程中发现,这里的链接其实链接 ...

  8. 五、Linux学习之文件搜索命令

    一.文件搜索命令locate locate 文件名 在后台数据库中按文件名搜索,搜索速度最快 /var/lib/mlocate #locate命令所搜索的后台数据库(数据库不会实时刷新,所以新建的文件 ...

  9. 【Asp.net入门4-03】条件断点

  10. Tomcat性能调优及JVM内存工作原理

    Java性能优化方向:代码运算性能.内存回收.应用配置. 注:影响Java程序主要原因是垃圾回收,下面会重点介绍这方面 代码层优化:避免过多循环嵌套.调用和复杂逻辑.Tomcat调优主要内容如下:1. ...