原本想这用django 写一个web 应用程序,便于管理mongodb的数据。结果django 不直接支持mongodb……又没时间研究NoSQL。因而想着随便整个api吧……python
因而先用flask 作个简单的demo 部署到本地试试水web
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/ 借鉴一下吧mongodb
<?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>
人家教程里写的好好的 “hello ……”django
而我倒是这样的json
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".
flask
是这样的……api
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. app
Add Application Development from the Features! Remember to add the 4.5 stuff if you need itasp.net
终于看到告终果……