[flask] hello

flask hello

0.hello.py

from flask import Flask
app = Flask(__name__)

@app.route('/')
def index():
    return '<h1>hello world.</h1>'

if __name__ == '__main__':
    app.run(debug=True)

运行起来就是python hello1.py

python hello1.py                                                                                                                                                   !10032
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger pin code: 270-940-657

1.增加一个manager

类似django的运行方式。需要的步骤也很少。
需要引入一个ext.script的包.

from flask.ext.script import Manager
manager = Manager(app)
# ...
if __name__ == '__main__':
manager.run()
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页