简体   繁体   English

如何在 Django Rest 框架中为单个发布请求发送两个响应?

[英]How to send two response for a single post request in Django Rest Framework?

I am processing a video in backend but it's taking some time so I am looking for a way by which I can send the process time first and after it's completion I can send the video url.我正在后端处理视频,但需要一些时间,所以我正在寻找一种方法,通过它我可以先发送处理时间,然后在完成后我可以发送视频 url。

I tried using HttpResponse.write() but it didn't send the response.我尝试使用 HttpResponse.write() 但它没有发送响应。 I got response only after the completion of whole process.只有在整个过程完成后我才得到回应。

You need async method and use something like websocket.您需要异步方法并使用类似 websocket 的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 django rest 框架中返回对成功 POST 请求的自定义响应 - Return custom response to successful POST request in django rest framework 使用 JWT 令牌 Django Rest 框架中对 POST 请求的未经授权响应 - Unauthorized response to POST request in Django Rest Framework with JWT Token Django Rest Framework:单个嵌套请求中的POST和PUT - Django Rest Framework: POST and PUT in a single nested request 每当我们使用django rest框架发出发布请求时,如何返回主键作为响应? - How to return primary key as a response when ever we make a post request using django rest framework? 发布请求Django REST框架 - Post Request Django REST Framework Django rest 框架 发布请求 - Django rest framework Post request How to send a post request from Reactjs frontend to django rest framework API, with nested object and file - How to send a post request from Reactjs frontend to django rest framework API, with nested object and file 如何使用序列化程序在单个 view.py 中发布两个模型的数据? django 休息框架 - how to post data of two models in single view.py using serializer? django rest framework 如何修改 django rest 框架发送的响应 - How can modify response send by django rest framework 如何使用 django rest 框架发送文件作为响应? - How do I use django rest framework to send a file in response?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM