I have a Django app where I have created a custom middleware.
It works as follows:
This is my question: Because my app has to wait for the API request to return before it can process the request, does it still make sense to use a task queue such as celery? Wouldn't it still have to block the thread while I waiting for the response?
No, using Celery here wouldn't make any sense at all. That's for tasks that can be purely out-of-process. A good example is sending a confirmation email; the response sent to the browser doesn't have to wait for the email to be sent, because it doesn't depend on it in any way.
In your case, the response explicitly does depend on the value from the API. There would be nothing to be gained from using Celery, and it would make the whole process much more complex than it needs to be.