DRF源码刨析
作者:互联网
一、开发模式
1、前后端不分离
- 前后端放在一块写
2、前后端分离
-
2.1、前端开发
-
2.2、后端开发
- 为前端提供API开发
- 永远返回HttpResponse
3、Django FBV、 CBV
-
3.1、FBV
def users(request): if request.method == 'GET': user_list = ['name': 'yiwen'] return HttpResponse(json.dumps((user_list)))
-
3.2、CBV
class StudentsView(View): def get(self, request): return HttpResponse('get') def post(self, request): return HttpResponse('post') def put(self, request): return HttpResponse('put') def delete(self, request): return HttpResponse('delete')
二、restful规范
三、django rest framework 框架
标签:return,list,刨析,request,源码,HttpResponse,self,def,DRF 来源: https://www.cnblogs.com/YiwenGG/p/14304222.html