Wednesday, April 29, 2015

Re: Django runserver needs restart on psql data changes

Hi Carl - that was *exactly* what I was doing - thanks a ton for finding that issue even without requiring the code. Now that I think about it, putting that definition in the global section makes absolutely no sense.

Appreciate your feedback,
-AB

On Wednesday, April 29, 2015 at 5:10:21 PM UTC-5, Carl Meyer wrote:
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/346855d5-2e89-4ccd-a2e7-0531a9573971%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment