I've Django running in Apache via mod_wsgi. In my opinion Django is caching my pages server-side, that is leading to a few of the functionality not to work properly.

I've got a countdown timer that actually works through getting the present server time, identifying the rest of the countdown time, and outputting that number towards the HTML template. A javascript countdown timer then gets control and runs the countdown for that user.

The issue arises once the user refreshes the page, or navigates to another page using the countdown timer. The timer seems to leap around to various occasions occasionally, usually returning to the same time frame again and again again on each refresh.

Using HTTPFox, the page isn't being loaded from my browser cache, therefore it appears like either Django or Apache is caching the page. Can there be in whatever way to disable this functionality? I am not likely to have sufficient traffic to bother with caching the script output. Or am I drastically wrong about why this really is happening?

[Edit] In the posts below, it appears like caching is disabled in Django, meaning it should be happening elsewhere, possibly in Apache?

[Edit] I've got a more thorough description of what's happening: For that first 7 (approximately) demands designed to the server, the web pages are made through the script and came back, although all of individuals 7 pages appears to become cached because it turns up later. Around the eighth request, the server delivers page one. Around the ninth request, it delivers the 2nd page, and so forth inside a cycle. This lasts until I restart apache, once the process begins once again.

[Edit] I've set up mod_wsgi to operate just one process at any given time, which in turn causes the timer to totally reset towards the same return in each and every situation. Oddly enough though, there's another component on my small page that shows a random image on each request, using order('?'), which does refresh with various images every time, which may indicate the caching is going on in Django and never in Apache.

[Edit] Considering the prior edit, I returned and examined the appropriate sights.py file, discovering that the countdown start variable had been set globally within the module, outdoors from the view functions. Moving that setting within the view functions resolved the issue. Therefore it switched out not to become a caching problem in the end. Thanks everybody for the help about this.

From my knowledge about mod_wsgi in Apache, it's highly unlikely that they're leading to caching. A few things to test:

  1. It's possible you have some proxy server involving the computer and also the web server that's properly or wrongly caching pages. Sometimes ISPs run proxy servers to lessen bandwidth outdoors their network. Are you able to please supply the HTTP headers for any page that's getting cached (Firebug can provide those to you). Headers which i would particularly want to consider include Cache-Control, Expires, Last-Modified, and ETag.
  2. Are you able to publish your MIDDLEWARE_CLASSES out of your configurations.py file. It possible that you've a Middleware that works caching for you personally.
  3. Are you able to grep your code for an additional products "load cache", "django.core.cache", and "cache_page". A *grep -R "search" ** works.
  4. Does the configurations.py (or anything it imports like "from localsettings import *") include CACHE_After sales?
  5. What goes on whenever you restart apache? (e.g. sudo services apache restart). If your restart clears the problem, then it may be apache doing caching (it's possible this may also obvious out a locmen Django cache after sales)

Have you particularly setup Django caching? In the paperwork it appears you'd clearly determine if Django was caching because it requires work in advance to have it working. Particularly, you have to define in which the cached files are saved.


Are you currently utilizing a multiprocess configuration for Apache/mod_wsgi? If you're, which will take into account why different reactions may have a different value for that timer as likely that after timer is initialised will change for every process handling demands. Thus why it may jump around.

Possess a read of:


Exercise with what mode or configuration you're running Apache/mod_wsgi and possibly publish what that configuration is. Not understanding, you will find a lot of unknowns.