摘要: 前言 渲染模块的原理和解析模块是一样,drf默认的渲染有2种方式,一种是json格式,另一种是模板方式。 渲染模块源码入口 入口:APIView类中dispatch方法中的:self.response = self.finalize_response(request, response, *args 阅读全文
posted @ 2021-06-08 14:38 Silent丿丶黑羽 阅读(184) 评论(0) 推荐(1) 编辑
摘要: 异常模块源码入口 APIView类中dispatch方法中的:response = self.handle_exception(exc) 源码分析 我们点击handle_exception跳转,查看该方法源码 def handle_exception(self, exc): """ Handle a 阅读全文
posted @ 2021-06-08 13:33 Silent丿丶黑羽 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 前言 上一篇分析了请求模块的源码,如下: def initialize_request(self, request, *args, **kwargs): """ Returns the initial request object. """ parser_context = self.get_par 阅读全文
posted @ 2021-06-08 06:06 Silent丿丶黑羽 阅读(213) 评论(0) 推荐(0) 编辑