草庐IT

methodview

全部标签

python - Flask - 嵌套的 rest api - 使用 methodview 以外的东西或者我做了一个糟糕的设计?

刚从Flask开始,接下来是http://flask.pocoo.org/docs/views/假设我有一个基本的RESTapi,在这种情况下用于症状:/GET-listPOST-create/GET-detailPUT-replacePATCH-patchDELETE-delete我可以使用Flask的MethodView非常干净地实现它,如下所示:fromflaskimportBlueprint,request,gfromflask.viewsimportMethodView#...mod=Blueprint('api',__name__,url_prefix='/api')cla

python - Flask MethodView 与 Flask-Restful 资源

MethodView和Resource有什么区别?它通过flask-restful实现API:classAPI(Resource):decorators=[...,]defget(self):#dosomethingdefpost(self):#dosomethingdefput(self):#dosomethingdefdelete(self):#dosomething其实可以用flask代替:classAPI(MethodView):decorators=[...,]defget(self):#dosomethingdefpost(self):#dosomethingdefput(