Wednesday, April 29, 2015

Re: Django runserver needs restart on psql data changes

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJVQVaNAAoJEC0ft5FqUuEhPpIQAK44SApGdUgk22ajVQALexOB
nYJb4sN5vHYHlYX0HlWayi1cQp7fSUOEUHPTG+CtrjXptaINcr7/5jIgSQ4fn+Sr
SHBd9L4dJY+UHthbm7qSBg5j5LmCRjTbMaALby8SZkWO/iXqp/kE1+DPfcyd2d8k
zIztsiB5uYtaDKWNQC/ubuObdcLg3q013huSmcEzWcy3Zm0f1wduWkYP8buffNkG
I8uiPyvMnR1FSD0BYYsU/0tKQqOXJLfpJOkJ86ndvKEgYxorCOwRGRZo3P3nvho7
lPySyDF7W9vSNj3fWjht7Vwmcca1FduDePWcyPbfNfNJqeWL2kmzUfxuA6bAczoY
Eo+SmK1ul2O3jsXI7WBj7ufs+fjdM6qfNVld4UmvCjURUC9ZgATYUjDimNbYvhOk
d78p4MBLMJK1oaTAizEAz0lq9OgP8RN8niXuhArj8KggGTTIvUZ6+pkj2ZQU/qT+
GnX2keSjYQAy2hHr7Svb2C0jf5PketcrBf6X12IQKyOMut9YG4twcNhvuhhr8Ama
iZRlcMYPmosDq6m/lP+pcF75Y3j1RgDsJo4wXfDM06gmcspUSR3L166Z/BHsOR87
x/VkDsIrIuuXjlm90PtJg5ZWJhRMAKdyLXFqIzCgt0i4iMxroNX4c6GFVi//L3RH
Oh7+LNqcG4/REd5MEbE8
=i3Tv
-----END PGP SIGNATURE-----
Hi Arnab,

On 04/29/2015 03:13 PM, Arnab Banerji wrote:
> Hi Javier - thanks for the response. Yes - I am storing the data in a
> dictionary - then having django_tables2 API render the dictionary as a
> table. How do I force a read of that variable for every browser refresh
> on the client side?

Using a variable is fine; the problem is that (I'm guessing) you are
creating that variable at the top level of the module. Such code is only
run once, when the module is first imported.

You need to make sure that all database queries are run only inside view
functions (or methods of view classes), never at the top-level of a module.

carl

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5541568D.1060808%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment