from django.utils.deprecation import MiddlewareMixin from django.http import HttpResponse class AuthMiddleWare1(MiddlewareMixin): def process_request(self, request): print('process_request-1') def process_view(self, request, callback, callback_args, callback_kwargs): print('process_view-1') def process_template_response(self, request, response): print('process_template_response -1') return response def process_exception(self, request, exception): print('process_exception-1') def process_response(self, request, response): print('prcoess_response-1') return response class AuthMiddleWare2(MiddlewareMixin): def process_request(self, request): print('process_request-2') def process_view(self, request, callback, callback_args, callback_kwargs): print('process_view-2') def process_template_response(self, request, response): print('process_template_response -2') return response def process_exception(self, request, exception): print('process_exception-2') def process_response(self, request, response): print('prcoess_response-2') return response