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
0
votes
2 answers

Some cache problems

I'm wondering if I can delete a cached content made in template cache. I want to delete it from my view. I have in my template {% cache 500 cache_name sites.number %} Is it possible to delete all "cache_name" cached content within the view, for…
robos85
  • 2,484
  • 5
  • 32
  • 36
0
votes
0 answers

django change cache settings when testing

I'm using redis as my cache server. When a user created , the post_save signal will save his information in redis with key="user_info_". However, when I run the unit test and create the user, the information will be overwritten. How can I…
ramwin
  • 5,803
  • 3
  • 27
  • 29
0
votes
1 answer

Handlebar changes are not affecting - Python Django

I am a django and python beginner. Django Application is hosted in apache webserver as daemon. I am facing the issue with rendering the URL in django using java script. In my handlebar(html template), i did some html changes, but, unfortunately…
reegan vijay
  • 161
  • 11
0
votes
0 answers

How to bind/trace django cache variable

I would like to save some value in Django cache and bind a trace function to it, so as soon as the value changes I would like to call a function. After the trace function has been called I would like to remove the bind. Django Cache Code. from…
Hangon
  • 2,449
  • 7
  • 23
  • 31
0
votes
1 answer

django-allauth caching login and signup pages

is there a way to set up Django Redis caching for login and signup views from django-allauth? I looked at docu and found nothing. I don't want whole site caching but only some views and these two are part of it.
Mous
  • 83
  • 9
0
votes
1 answer

django cache.clear() ending session (logout)

I'm using memcached in Django to cache the entire site. https://docs.djangoproject.com/en/1.11/topics/cache/#the-per-site-cache I've added some code in a post-save signal handler method to clear the cache when certain objects are created or updated…
Martinez Mariano
  • 541
  • 8
  • 19
0
votes
1 answer

Django rest - understand cached results

I have slow queries in my Django restframework project. Many nested serializers are causing slow HTTP requests (2-5 seconds) So I thought about using a cache that Django can provide with Memcache server. But I'm afraid I don`t really understand its…
Oz Bar-Shalom
  • 1,747
  • 1
  • 18
  • 33
0
votes
1 answer

Django template reading wrong cache value

I am caching in my django template like this. {% load cache %} {% cache cache_timeout key_name model_id %}
{{some_variable}}
{% endcache %} Where cache_timeout is a variable I set in the view with the…
Lombo
  • 11,847
  • 2
  • 20
  • 27
0
votes
0 answers

Uncaching the results of a particular view in django

I have come across this project. It uncaches the results of a particular view in django. I want to do a similar thing but I read that this project is no longer updated. I am using Memcached and Django 1.8. I want to delete all the cache entries of a…
Shahrukh Mohammad
  • 985
  • 2
  • 17
  • 33
0
votes
1 answer

Django - Disable Page Level Caching by User

I've set up page level caching for many of our pages. However once in a while an admin user logs in to preview potential changes to the site. Is there a way to disable page level caching just for these users? I read through the docs but I didn't…
Greg
  • 45,306
  • 89
  • 231
  • 297
0
votes
1 answer

Check User online Django 1.10

Hi trying to do like in example: How to check whether a user is online in django template? but when adding 'userprofile.middleware.ActiveUserMiddleware', to MIDDLEWARE_CLASSES recieving next error: Unhandled exception in thread started by…
Hellbea
  • 289
  • 6
  • 14
0
votes
1 answer

Django doesn't use memcached framework

I'm trying to find out how Django caching framework works. I set memcached in settings.py but the time of loading page didn't get smaller and Django-debug-toolbar shows 0 cache calls. This is what I've set in settings.py: CACHES = { 'default':…
Milano
  • 18,048
  • 37
  • 153
  • 353
0
votes
1 answer

Trying to minimize the number of trips to a database voting table

I use django 1.10.1, postgres 9.5 and redis. I have a table that store users votes and looks like: ========================== object | user | created_on ========================== where object and user are foreign keys to the id column of their own…
Ejonas GGgg
  • 446
  • 1
  • 6
  • 19
0
votes
1 answer

Caching django cms CustomPlugin

I am developing a website using DjangoCMS, fully front-end editable using CustomPlugins. I was wondering if is there any workaround to not cache plugins that are inside specific placeholders. Let's say I have a CustomPlugin, and I want this plugin…
alamasfu10
  • 33
  • 6
0
votes
1 answer

erase template cache

I have a Django app where users can select between 2 interface modes, that mode affect some pages... for those pages I use different templates In urls.py I have something like this: mode = Config.objects.get().mode urlpatterns = patterns('', …
juanefren
  • 2,818
  • 6
  • 32
  • 41