title: How to add two render in Django function views
body: <p>How to add two render in single function based views. I don't know this can be done, if not please provide the alternative way of doing this.</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def success(request):
      return render(request, "tools/loading.html", {})
  
  
      #Raspberry pi code
      print("on")
      pin13.write(1)
      time.sleep(2)
      print("off")
      pin13.write(0)
  
      return render(request, "tools/booked.html", {})
  </code></pre>
  
  <p>Currently it won't run the raspberry pi code, it directly returns the page and skip the rest of the code down the first render. </p>
  
  <p>But I need to update this code so that when calling this 'success' function based view it should return the 'loading.html', after performing the Raspberry pi code it should return another page. All this should be done in backend.</p>