1đź‘Ť
You’ll need to poll the backend from the browser periodically to see if there are any updates. This does assume that the long-running script is running asynchronously. The periodic update is akin to a log file tail, once in a while you check if new information has been added to the log.
There are several existing jQuery plugins that’ll help you build this; PeriodicalUpdater for jQuery is a nice one, in that it’ll adjust the poll interval if the server response doesn’t change in a while.
Basically, with such a plugin, you’ll need a Django view that returns the current status, the log file output of your process so to speak, and have PeriodicalUpdater poll that view. In the callback function for PeriodicalUpdater you’ll need to add a check that the process is complete, of course; perhaps your server view could end with an easy to detect “Process complete” line at the end of the “log”, or return a response that only consists of the final status.