I know some concepts that Django (DRF) is synchronous and it has some workers, but I know little about this.
I tried to verify this and created this view at the address http://localhost:8000/my-view/:
def my_view(request): # Simulate some time-consuming task time.sleep(10) return HttpResponse("Response after 10 seconds")
I proceeded to open 7 terminals and execute the same command on each of them within a range of 1-2 seconds (almost simultaneously):
curl http://localhost:8000/my-view/ -H 'Content-Type: application/json'
--> and the result was that in each terminal I received response in 10-12 seconds.
Here is the question, if Django is synchronous so why it did not take 70 seconds to execute these requests one by one?
The only explanation I can think of is that it uses multithreading.