Questions tagged [django-cache]

Django includes a cache system that lets you save dynamic pages or page fragments so they don't have to be generated for each request.

Django comes with a robust cache system that lets you save dynamic pages so they don't have to be calculated for each request. For convenience, Django offers different levels of cache granularity: You can cache the output of specific views, you can cache only the pieces that are difficult to produce, or you can cache your entire site.

Django also works well with "upstream" caches, such as Squid and browser-based caches. These are the types of caches that you don't directly control but to which you can provide hints (via HTTP headers) about which parts of your site should be cached, and how.

See also:

248 questions
1
vote
2 answers

Django admin cache m2m relation

I have two models: models.py class City(models.Model): title = models.CharField(max_length=255) show = models.BooleanField(default=True) class Company(models.Model) title = models.CharField(max_length=255) cities =…
1
vote
4 answers

django + memcached: problem with limit of 1 mb

Does anyone know about any solutions for keeping data bigger, than 1mb in memcached ? This is no big deal to cut big data to 1mb pieces before setting and merge this pieces after getting from memcached. And this algorithm can work transparently for…
ramusus
  • 7,789
  • 5
  • 38
  • 45
1
vote
1 answer

Getting started with Django middleware, sessions, and caching

Each user in my Django application is associated with a department, and virtually every request involves some department-related processing. So I'd love to make the department object available across the entire application. Which of these, if any,…
tino
  • 4,780
  • 5
  • 24
  • 30
1
vote
0 answers

Getting caching working with Django

We are trying to implement caching in Django. We have tried memcache, file system caching and local memory caching. No mater what it just isn't working -- a timestamp we put on the template to test caching is always updating so we know it's not…
user1328021
  • 9,110
  • 14
  • 47
  • 78
1
vote
1 answer

Django Cache Implementation

Well, I'm designing a web application using Django. The application allow users to select a photo from the computer system and keep populating onto the users timeline. The timeline view have a list/grid of all the photos which the user has uploaded…
Praful Bagai
  • 16,684
  • 50
  • 136
  • 267
1
vote
2 answers

Django Cache + Django Database request

I'm building a Django web application which allow users to select a photo from the computer system and keep populating onto the users timeline. The timeline will be showing 10 photos initially and then have a pull to refresh to fetch the next 10…
Praful Bagai
  • 16,684
  • 50
  • 136
  • 267
1
vote
0 answers

Disabling johnny-cache in admin

I am using johnny-cache. Is there an easy way to disable it from Admin, but let it work transparently everywhere else? I have looked in the johhny cache docs - http://pythonhosted.org/johnny-cache/, but can't seem to find this.
shabda
  • 1,668
  • 1
  • 18
  • 28
1
vote
1 answer

Django: how to delete template cache when your cache key uses GET params?

This problem has been bugging me all morning: I have some views which accept GET params to modify the queryset (order_by and pagination) and cache it. These views are very similar and they all share the same template. These template caches a part…
la_f0ka
  • 1,773
  • 3
  • 23
  • 44
1
vote
0 answers

Defining another Cache-Control than the set cache timeout in Python / Django

I'd like to cache my view as follows: @cache_page(10) def myview: return HttpResponse('content') This automatically caches my view for 10 seconds and automatically sets Cache-Control/Expire header as well. I'd like to cache my view for only 10…
holger359
  • 131
  • 1
  • 6
1
vote
2 answers

Django Johnny cache - include tables instead of exclude using MAN_IN_BLACKLIST?

I'm aware of Johnny cache's MAN_IN_BLACKLIST and JOHNNY_TABLE_BLACKLIST. Is there a way to specify the reverse? That is specify only the tables that need to be cached? I want to do this for the simple reason that we have over 200 tables in the…
ksrini
  • 1,412
  • 2
  • 19
  • 33
0
votes
1 answer

How to apply Django cache control on included urls?

I have enabled site-wide Django caching, but the third-party apps I am using have not specified any cache-control expectations. So, I am guessing that their views will get cached. The problem is that I do not want Django to cache the views of some…
AppleGrew
  • 9,302
  • 24
  • 80
  • 124
0
votes
2 answers

Django optimize code for large data filtering

As I am searching through 15000 results, is there any way to optimize the processing speed? In my VIEW I'm filtering search as this: if form.is_valid(): results = Screening.objects.filter( …
Abhaya
  • 2,086
  • 16
  • 21
0
votes
2 answers

What is the best deployment configuration for Django?

I will be deploying my django project on the server. For that purpose I plan on doing the following optimization. What i would like to know is that am I missing something? How can I do it in a better manner? Front-end: Django-static (For…
Akamad007
  • 1,551
  • 3
  • 22
  • 38
0
votes
1 answer

Global variable/Variable caching in Django

In my website, I want to present to the user the most viewed product categories in a sidebar, in multiple pages. so in each different view I have: variables = RequestContext(request, { (...) 'most_viewed_cats':…
user1034697
0
votes
1 answer

Django low-level cache API not working

I'm trying to cache the request.POST dict using the low-level cache API, but it seems to not be working. Instead of the cached dict I get the None value. Here's what I tried: print cache.get('forms_data') # It is None education_formset = Education( …
I159
  • 29,741
  • 31
  • 97
  • 132