达所
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()