0

I have a simple Python/Django Application in which I am inserting records in database through some scanning event. And I am able to show the data on a simple page. I keep reloading the page every second to show the latest inserted database records.But I want it to improve so that page should update the records when ever new entry comes in database, instead of reloading every second.

Is there any way to do this?

Database: I am using MySQL

Python: Python 2.7

Framework: Django

itsjeyd
  • 5,070
  • 2
  • 30
  • 49

1 Answers1

1

An elegant solution, in my opinion, would be to use Knockout in combination with a polling ajax query to update an observableArray of your model/entity on the page.

Regardless of what JavaScript technology you implement, the only way to update a portion of the page, without reloading the page, is to use JavaScript and an ajax request that requests new data. That data then gets appended to the page.

You can either poll for the data on an interval or take a WebSocket approach for true pub/sub.

Brandon Taylor
  • 33,823
  • 15
  • 104
  • 144