How to set Timeout for Django Rest HTTP request

14,246

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.

Share:
14,246
AJ91
Author by

AJ91

Currently I am working in Python and like to explore new softwares and technologies.

Updated on June 05, 2022

Comments

  • AJ91
    AJ91 almost 2 years

    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 :)