You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have many static files and the compression is very slow (~5 minutes). There are many files collected, that would be probably never used by website users.
If there was some settings similar to WHITENOISE_SKIP_COMPRESS_EXTENSIONS which would allow to add file patterns to skip compression, that would solve my problem.
The text was updated successfully, but these errors were encountered:
This is a good idea IMO...
There is a should_compress() function on the Compressor class, which can let you have complete control over the compression decision.
Rather than just setting a file pattern, a really flexible way to handle this in Whitenoise could be to have a setting that allows configuring the Compressor class in settings, and then you provide your own (where you override the should_compress() function). That would let you select based on filename pattern but also on other things like a lookup or file size etc.
from whitenoise.compress import Compressor
class CustomCompressor(Compressor):
def should_compress(self, filename: str) -> bool:
if filename.startswith("big_assets/"):
return False
return True
For WSGI apps, this could also work with an extra command line option to the whitenoise.compress CLI, that instantiates your custom class instead of the normal one:
I have many static files and the compression is very slow (~5 minutes). There are many files collected, that would be probably never used by website users.
If there was some settings similar to
WHITENOISE_SKIP_COMPRESS_EXTENSIONS
which would allow to add file patterns to skip compression, that would solve my problem.The text was updated successfully, but these errors were encountered: