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.
views.py
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", {})
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.
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.