Example

#!/usr/bin/env python
# encoding: utf-8

from flask import Flask
app = Flask(__name__)

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

if __name__ == '__main__':
    app.run(debug=True)
    #app.run(host='127.0.0.1', port=8000)
#!/usr/bin/env python
# encoding: utf-8

from flask import Flask
from flask import Request

class FooRequest(Request):
    """
    """
    want_form_data_parsed = False

app = Flask("FOO", static_folder=None)
app.request_class = FooRequest
app.config.from_pyfile("/path/to/config.py")
app.config.get("foo")

app.add_url_rule(rule="/<path:path>", view_func=request_dispatcher,
        methods=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS"])
app.add_url_rule(rule="/", view_func=request_dispatcher,
        methods=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS"])

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

Welcom to Flask
Flask使用小结

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐