1

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

3 Answers3

2

you need to elemplments the poll/long poll or server push.

Yohn
  • 866
  • 8
  • 11
1

You can look for websockets...

Looking a this page may help... https://www.djangopackages.com/grids/g/websockets/

pypi.python.org/pypi/django-websocket

A post on the subject here

Community
  • 1
  • 1
Xelt
  • 406
  • 3
  • 9
-1

Its really easy.

NOTE : You need one database field for store create row date time

**Algo**

Its really easy..

Step 1) When page render try to fetch all data from database

Step 2) store latest created date in javascript variable

Step 2) After interval by jquery or other client side programming language try to fetch only those data which is more then latest created date

step 3) Append new row by jquery or other client side programming language

Ronak Amlani
  • 654
  • 7
  • 15