title: how to do async task in django?
body: <p>Suppose I need to request multiple servers to make a response</p>
  
  <pre><code>def view_or_viewset(request):
  
    d1 = request_a_server() # something like requests.get(url, data)
    d2 = request_b_server()
    d3 = request_c_server()
  
    d4 = do_something_with(d3)
  
    return Response({"foo1": d1, "foo2": d2, "foo3": d3, "foo4": d4})
  </code></pre>
  
  <p>I'm doing synchronous requests for each request, and I guess there must be a better way of handling this kind of scenario.. </p>
  
  <p>(I would use celery if it is long task, but it is not, still doing multiple synchronous requests doesn't seem right)</p>
  
  <p>What's the recommended paradigm (?) of handling this?</p>
  
  <ul>
  <li>edit </li>
  </ul>
  
  <p>I was expecting use of <code>async</code> or <code>aioHttp</code> and <code>yield</code>(?)</p>
  
  <p>and my question was flagged with possible duplicates and the answers there suggest using threading.. I think manually handling threading is something to avoid (from my past experience with multi threading in c++)</p>
  
  <p>then I found <a href="https://stackoverflow.com/a/23902034/433570">https://stackoverflow.com/a/23902034/433570</a> 
  request-future seems to be promising here..</p>