Execute code in Django after response has been sent to the client

前端 未结 3 1762
独厮守ぢ
独厮守ぢ 2020-11-27 18:58

In my Django application I want to keep track of whether a response has been sent to the client successfully. I am well aware that there is no \"watertight\" way in a connec

3条回答
  •  隐瞒了意图╮
    2020-11-27 19:30

    I suppose when talking about middleware you are thinking about the middleware's process_request method, but there's also a process_response method that is called when the HttpResponse object is returned. I guess that will be the latest moment where you can find a hook that you can use.

    Furthermore there's also a request_finished signal being fired.

提交回复
热议问题