in Education by
[additional information] I asked for a way to disable caching site-wide. This is probably overkill, because all I need is a way to be able to see the most recent version of a page, when either the database or the program to generate it has been modified. There is a strong consensus that modifying settings at runtime is a very bad idea. So, some ideas: clearing the cache could work, as would sending a flag to specify that I don't want to see a cached version, or specifying that requests from my IP address shouldn't see cached pages. [original question] I have a Django-based website at ozake.com, and I frequently rewrite parts of the programming or change page content. Each time I work on it, I modify settings.py to disable caching so I can see my modifications in real time. When I'm done, I re-enable caching. I am using file-based caching. Here is the relevant part of settings.py: CACHES = { 'default': {'BACKEND': #'BACKEND': 'django.core.cache.backends.dummy.DummyCache', 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', 'LOCATION': '/var/www/mysite.com/cache', When I work on the site I comment out the last two lines and uncomment the dummy cache line. This means SSH'ing into the site, modifying settings.py, working on the site, then re-modifying it. Is there any way I can make this into a check box somewhere in /admin with admin.py? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
If you just want to invalidate the whole cache at will, you might create a trivial view which does that: file views.py: from django.core.cache import cache from django.core.exceptions import PermissionDenied from django.http import HttpResponse from django.views.decorators.cache import never_cache @never_cache def clear_cache(request): if not request.user.is_superuser: raise PermissionDenied cache.clear() return HttpResponse('Cache has been cleared') file urls.py: from django.urls import path from . import views urlpatterns = [ ... path('clear_cache/', views.clear_cache), ] then invoke it with your browser: http://HOST/clear_cache

Related questions

0 votes
    Suppose I have a model Order, which has a column num -- an order number. Now I want to filter ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    What are the ways to customize the functionality of the Django admin interface?...
asked Jul 2, 2021 in Technology by JackTerrance
0 votes
    we're planning to use some robotics for copy and paste some routine information to our internal tool. ... machine learning concepts Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    we're planning to use some robotics for copy and paste some routine information to our internal tool. ... machine learning concepts Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    This is our setup: Windows 2003 Server Standard, SQL 2005 and ASP.NET 4.0. We have a news site ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    What is the caching strategies in the Django?...
asked Jul 1, 2021 in Technology by JackTerrance
0 votes
    Is it possible to assign the field type dynamically - Django Form? field_type = 'CharField' field = forms. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    Is it possible to assign the field type dynamically - Django Form? field_type = 'CharField' field = forms. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    If the AD B2B account is e-reference, can an admin block this? Could an admin prevent their users from being guest users in another tenant?...
asked Mar 10, 2021 in Technology by JackTerrance
0 votes
    When I try to open the Plesk Login Page via :8443 I get the Error: ERROR: Uncaught Error: Class ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 10, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me how to land a job with Salesforce Admin Certification? Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    What do you mean by admin in WebLogic?...
asked Jun 10, 2021 in Technology by JackTerrance
0 votes
    How to reset Splunk Admin password?...
asked Oct 31, 2020 in Technology by JackTerrance
0 votes
    __________ is increasingly being used in server systems to improve performance by caching frequently used data, ... in portion Storage and File Structures of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
...