python Flask源码

先上一张手绘流程草图,有时间再贴上源码和软件画的图


  1. Flask CBV 写法

import functools
from flask import Flask, views

app = Flask(__name__)


class UserView(views.MethodView):
    methods = ['GET']
    decorators = [wrapper, ]
    def get(self, *args, **kwargs):
        return 'GET'
    def post(self, *args, **kwargs):
        return 'POST'

app.add_url_rule('/user', None, UserView.as_view('uuuu'))

if __name__ == '__main__':
    app.run()
posted @ 2020-07-06 18:06  该显示昵称已被使用了  阅读(154)  评论(0编辑  收藏  举报