4-----flask快速入门
达所
Flask官网 https://dormousehole.readthedocs.io/en/latest/patterns/index.html#patterns
from flask import Flask,url_for import json app = Flask(__name__) app.debug= True @app.route('/') def hello_world(): return 'Hello World!' @app.route('/user/<username>') def show_user_proeile(username): return 'User %s' %username @app.route('/post/<int:post_id>') def show_post(post_id): return 'Post %s' %post_id @app.route('/hello/<name>/') def hello(name=None): data = {'a':name} return json.dumps(data) if __name__ == '__main__': app.run()
本文来自博客园,作者:王竹笙,转载请注明原文链接:https://www.cnblogs.com/edeny/p/12625089.html