How can I increase django execution time of a view. Some views of my app do very long tasks that timeout. So I want to increase execution time of my django application
Asked
Active
Viewed 2,980 times
-1
-
I don't know who downvoted this also, but if you want to speed up execution this question makes no sense at all without showing your codebase to see where cuts can be made – Hedde van der Heide Jun 27 '12 at 08:48
-
i dont want to speed up execution. I meant to increase timeout of my scripts. They usually timeout after few seconds. I want to increase it to lets say 5 minutes – user557105 Jun 27 '12 at 08:50
-
have a look at http://stackoverflow.com/questions/1582708/long-slow-operation-in-django-view-causes-timeout-any-way-for-python-to-speak – Hedde van der Heide Jun 27 '12 at 08:51
-
I dont want to use ajax.It can not be implemented with ajax. In php it is simple you just set a variable in php.ini that increase the timeout of php script. cant anything similar be done to django? – user557105 Jun 27 '12 at 08:54
-
1@user557105 You don't even mention what webserver you're using. How should we be able to help you? Please read the [FAQ](http://stackoverflow.com/faq) regarding how to ask questions. – Danilo Bargen Jun 27 '12 at 08:57
1 Answers
6
You're trying to solve a problem that doesn't exist. Django doesn't limit the time of your response, so there is no timeout. If you're getting timeout errors, that's probably because your users' browsers - or maybe even your users themselves - are getting bored and giving up.
In any case, you shouldn't be trying to do long-running calcuations in online views. Do them offline via cron tasks or something like Celery.

Daniel Roseman
- 588,541
- 66
- 880
- 895