django project avoid reload page where work algorithm

Richard Damon Richard at Damon-Family.org
Sun Oct 8 15:48:27 EDT 2017


On 10/8/17 11:58 AM, Xristos Xristoou wrote:
> Τη Κυριακή, 8 Οκτωβρίου 2017 - 6:35:28 μ.μ. UTC+3, ο χρήστης MRAB έγραψε:
>> On 2017-10-08 15:27, Xristos Xristoou wrote:
> 
>> Do you mean "long reload"?
> 
> user can put some numbers in my html template and i take that numbers and i sue it in specific mathematical algorithm that algorithm to create result need time  between 5-10 minutes in that time browser stay on reload...that i mean
> 

It sounds like the fundamental problem is that you are doing the 
calculation in the web page handler. This means that the browser will be 
stuck in the page load until the calculation finishes, and that if the 
user aborts the access (or loses connection) then the web page handler 
is aborted.

What you need to do is rather than doing the calculation in the page 
handler, you need to kick off an independent process to do the 
calculation, and then immediately finish the page (maybe giving the use 
a link to a page they can check to see if a result is available).



More information about the Python-list mailing list