csrf的中间件 源码简略分析: def process_request(self, request): # 从cookies中获取csrf_token csrf_token = self._get_token(request) if csrf_token is not None: # Use same token next time. # 将csrf_token添加到request的头部信息中 request.META['CSRF_COOKIE'] = csrf_token def proce…