how to Leverage browser caching in django
caching, django, python
Solution
For views, you use the `cache_control` decorator.
For static content, do this in your web server configuration. If you're using nginx, here's what you need to add to your Nginx site configuration:
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 168h;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
You might want to customize this a bit (e.g. match your `STATIC_PATH` instead of extensions, or use different expires headers).
Problem
I made a small site in Django but while checking the site performance with Google pagespeed I get the recommendation as Leverage browser caching but i cant find a way to achieve it in django