AJ91
AJ91

Reputation: 140

How to set Timeout for Django Rest HTTP request

I am using Python 3.5, Django 1.9.5 and Django Rest Framework 3.3.3. I have only few POST apis in my server.

How can I set Timeout for each rest http request that if the execution for a request takes more then 3 minutes than it should return timeout in response and should stop execution of that request.

Thanks :)

Upvotes: 4

Views: 21159

Answers (1)

Timmy O'Mahony
Timmy O'Mahony

Reputation: 53998

I think you will need to set this at the proxy/web server level.

With nginx you can use proxy_read_timeout:

proxy_read_timeout 180s;

Or you could set it at the application server level. Gunicorn has a timeout setting.

Upvotes: 7

Related Questions