Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After spending a day on this problem, I've discovered the solution: </p> <p>I upgraded from uWSGI <strong>1.0.2.1</strong> to <strong>1.9.8</strong>. </p> <p>I verified that going back to 1.0.2.1 caused the problem to resurface. I don't have an explanation as to WHY this is the case, but nonetheless, being on the latest uWSGI probably isn't a bad idea anyway.</p> <hr> <p>Further investigation revealed that the problem I was experiencing was occurring in other areas. For example:</p> <p>In the admin area, I would change an user from being active to inactive and then save the form, redirecting me back to the list of users. After clicking on the same user that I just deactivated, the check box would appear checked. Refreshing the page would reveal that "Active" was no longer checked. </p> <p>Here's the part you might not expect: <strong>A second refresh of the page would cause Active to appear checked!</strong></p> <p>I was seeing this same behavior with my own forms as well. So I created a simple template that only contained <code>request.user.first_name</code> and <code>{% now "U u" %}</code>. The timestamp's purpose was to determine whether the rendered template was being cached or not.</p> <p>In one tab, I updated the user's first name. In another tab, I quickly refreshed the new template. This caused it to <strong>alternate</strong> between the <strong>new</strong> value and the <strong>old</strong> value. The timestamp incremented correctly, no caching.</p> <p>I thought maybe it was my browser (firefox). I opened chrome in incognito mode. In chrome, I opened the new template. In firefox, I submitted the form to change the user name. Back in chrome, I started to refresh quickly. Same exact behavior. </p> <p>Jumping into dbshell and hitting the mysql db directly always gave me the correct value, no alternating.</p> <p>In an attempt to rule some things out, I tried the following:</p> <ul> <li>Set the default <code>CACHES</code> backend to DummyCache (did not work)</li> <li>Set <code>CACHE_MIDDLEWARE_ANONYMOUS_ONLY</code> to True</li> <li>Installed <code>django-debug-toolbar</code> to look at the SQL directly. Refreshing the toolbar's sql quickly caused it to alternate values too!</li> </ul> <p>I only started observing this issue after I had upgraded to django 1.5.1. Previously I was on django 1.4.2. </p> <p>In sum, I propose that this be called the <strong>django/uwsgi uncertainty principle</strong>. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload