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

How to cache data in django channels and celery?

I am building a web-app using django channels. I also have a task function which i run periodically ( every 30s) using celery beat. This task function sends data to my web-socket every 30s. Now, if a consumer joins my channel group, he has to wait…
DigBick
  • 21
  • 4
0
votes
1 answer

How to use the cached results in cacheops with django

I am trying to use cacheops where I have a view that contains a variable I want to cache bo = Bo.objects.all().cache() The chached bo I tried to use in another view like this all = cache.get('bo') This does not work Here is the traceback .... …
fakeMake
  • 738
  • 8
  • 18
0
votes
1 answer

Caching on memory store from cloud run create error Unable to create a new session key. It is likely that the cache is unavailable

I have an application deployed on Cloud Run. It runs behind an HTTPS Load balancer. I want it to be able to cache some data using memory store service. I basically followed the documentation to use a serverless vpc connector but this exception keeps…
0
votes
0 answers

New Django project admin urls are somehow being overridden by prior project Django-Allauth settings

I have a new project, using DRF, and when trying to login to admin panel I get an error stating that the page not exist. The problem is that the url being generated when entering the current url is the same url that I used in my prior project using…
0
votes
1 answer

Django local memory cache is re-fetching each time

I am using Django's local memory cache in development and I can't get it to work. I have set the following in settings.py: CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' } } I see the views are…
Anupam
  • 14,950
  • 19
  • 67
  • 94
0
votes
0 answers

Is caching helpful in the web app by django?

I've made my first project app with Django Framework. Now I'm trying to use local memory based caching since I'm just testing its functionality and latency. As most part of my site contains dynamic web pages with different contents for different…
0
votes
1 answer

When and what data should be cached?

I want to know when should I cache data? Should I cache ListViews? or DetailViews? What kind of data do I need to cache and does the amount of data matter? When to cache? When not to cache? I want to know when should I decide to cache data? P.s: I…
Mojtaba Arezoomand
  • 2,140
  • 8
  • 23
0
votes
1 answer

Config for 'Cache' in settings.CACHES missing

I have configured cache in settings.py in my Django project as follows: CACHE_MIDDLEWARE_ALIAS = 'Cache' CACHE_MIDDLEWARE_SECONDS = 60 CACHE_MIDDLEWARE_KEY_PREFIX = '' CACHES = { 'default': { 'BACKEND':…
Roxell
  • 31
  • 6
0
votes
2 answers

Django: safely store auth token to be share along all django users

I build a Django site wheres requires all users to be authenticated using the standard authentication of Django. In some of the pages django will be doing Request to a third party site which also require authentication. This third party site is not…
Manza
  • 2,109
  • 1
  • 27
  • 34
0
votes
1 answer

Unable to use django-cachalot with django-tenants

Trying to use django-cachalot with django-tenants. I get the following error right at the start. Anyone got a resolution? (cachalot.W003) Database engine 'django_tenants.postgresql_backend' is not supported by django-cachalot. HINT: Switch to a…
Nitin Nain
  • 5,113
  • 1
  • 37
  • 51
0
votes
2 answers

How to force python keep variable in memory (cache)?

I have a python memory management problem. I have a django application running on windows that loads a 2gb model in memory (using dictionary and numpy). The problem happens when I run this application in the background (using the windows scheduler),…
0
votes
1 answer

AttributeError: 'NoneType' object has no attribute 'append' error in Django project

I'm trying to store a list of items in a Django session. The code is below, def index(request): today = date.today() d = today.strftime("%A, %B %d") if request.method == 'POST': item = request.POST.get('newItem') items =…
Giri Kishore
  • 21
  • 1
  • 6
0
votes
1 answer

How to add "public" by default to cached views by Django?

Im trying to use Google Cloud CDN to cache Django responses. Django properly sets the cache-control header with the max age, but it is missing the 'public' part of the header. Basically, currently all cached views have: cache-control:…
user3217163
  • 67
  • 1
  • 6
0
votes
0 answers

Django cache framework not working with django-cms

I am using django 3.1 and the database caching and it is working properly, but when I included the django-cms in the project and ran python3 manage.py createcachetable as per the document of the cache framework it's giving an error Traceback (most…
Ravindra Gupta
  • 1,256
  • 12
  • 42
0
votes
0 answers

How can I disable a Django cache?

I have written a small django app and in it I can upload some documents and at another point I can make a reference from a payment to the corresponding document. But my problem is that the list of documents is always outdated. But when I kill my…
MDoe
  • 163
  • 1
  • 13