1

I need to clear my cache each time when I restart my server..

Is there any other way to automatically clear the cache for my project only, so that the template reflects my new changes?

1 Answer 1

1

I'm assuming you're talking about the server side django cache, since the browser cache should only be kept if you're sending the correct client side http headers.

Flushing the cache should really only need to be done in development - so you can see the changes reflected as you work. So, for production, just let the cache expire naturally.

In development or test, set your cache backend to the in memory cache. To do so, set your cache settings in your development settings file:

CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'unique-snowflake' } } 

Now, when you restart your development server, the cache will be destroyed.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.