Thursday, August 1, 2013

Re: Django Signal DataBase Change on Template

You are describing a push mechanism, ie. the server pushes new data to the client when it becomes available. That is basically untenable in a standard web server/client paradigm, and django explicitly is built for request/response pairs.

That said, you can initiate the updates from the client.

The easiest way would to set up client polling, using an ajax call on the client side to fetch new/updated data.


You would do something like:
<script>
while(true){
setTimeout(function() {      //Put ajax call here, that fetched data and on success updates the DOM with the new data  }, 3000);//This would trigger every three seconds, tailor to your needs.
}
</script>

Depending on how many clients you are expecting to serve and how often you set the poll this has the potential to seriously tax your server.

On Thursday, August 1, 2013 9:54:58 AM UTC-5, Saif Jerbi wrote:

I'm building a GPS Tracking System using Django, i should have a grid on my template that display real time information of cars (position,vitesse, temperature...). GPS send data to Postgres DataBase via a module that parse Data and saved it in specific table. What i need is how to make my Web App display data in real time? (when a row is inserted in Db, how can i display it in grid)

i tried this package https://pypi.python.org/pypi/django-db-signals/0.1.1, but my DataParser is external from my django web app, it work independently from other side

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate