Currently, when Django serves static files in development it doesn’t include any cache headers, which allows the client to decide for itself whether or not, and for how long, to cache the resource. Instead, Django should serve these files with a Cache-Control: no-cache
header to prevent caching.
This issue has been raised in several tickets (27572, 32891, 33148), and is marked as wontfix
because, in brief, “We want to see the caching correctly set”.
The problem is that we don’t know how to correctly set the caching. Since Django doesn’t serve static files in production, that information exists somewhere else (an Apache configuration file, for example). Any given file could be designed to be cached forever, or never, or anything in between.
Given that, the only reasonable approach is to instruct the client not to cache files. Caching is an optional feature of HTTP, and not caching just means the server is receiving the requests it was designed to receive. Not caching can’t break your website, but caching files that were not meant to be cached definitely can.
Even if you think that static files should be cached by default in development, leaving off cache headers is the worst way to accomplish that. That allows the client to cache the files for an indeterminate and unreproducible amount of time, which is not what you want in a development environment.
(The tickets above are mostly focused on the issue of developer convenience. I think that’s another good reason not to cache - and presumably that’s why whitenoise disables caching in development even though it actually does know what the correct values should be - but the more important concern is the correctness issue.)