Pushing updates from Python server to web interface
The following options are available for real-time or semi-real-time data exchange between web pages:
-
Automatically refresh the page after certain seconds using the meta refresh tag in HTML
<head>
-
Fetch updated data using JavaScript and AJAX HTTP GET: https://api.jquery.com/jquery.get/
-
Use Server Sent Events: http://www.html5rocks.com/en/tutorials/eventsource/basics/
-
Using WebSockets: http://www.html5rocks.com/en/tutorials/websockets/basics/
All approaches except the first require rudimentary JavaScript skills other than server-side knowledge of Python. The last two approaches recommend an in-depth understanding of real-time communications. Thus, if you are not familiar with web development, I recommend choosing the update meta tag.
On the server side, you need to start a process or thread that will handle the long running process and then process that process in the database. When the web UI refreshes, it reads the latest results from the database and pushes / returns them to the browser.
source to share