Forums

Django static - Cache TTL = None (Chrome Tools - Lighthouse)

Hi,

I run the Lighthouse tool on my Django 2.2 python 3.7 app , it reports I have no cache TTL for my static assets.

I read elsewhere in forums that the service provides a reasonable default for caching static files.

I'm certain I am missing something simple, appreciate any pointing in the right direction.

Thanks

Paul

Our idea of what is a reasonable default and Lighthouses may differ. If you do not like our choices, you can serve the static files yourself from Django and then set whatever headers you like on them.

Our default is to use the 'Last-Modified' header and accept an 'If-Modified-Since' headers in the request. That means that the static assets will be re-downloaded if they have changed since they were saved to the cache, but they will be loaded from the cache if they have not changed.

Glenn,

Thanks, understood I can see the caching is working fine, I still don't really understand why the Lighthouse tool reports None for the TTL, but that for sure it not your issue or mine.

Paul

They're correct to report that there's no TTL, but that's because we don't set one -- the system we use to handle caching of static assets doesn't depend on having it.