python Flask源码
先上一张手绘流程草图,有时间再贴上源码和软件画的图
- 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()