devilry / trix2

Next generation Trix. Detailed task control and statistics app for better learning outcome.
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

Caching with WhiteNoise storage backend fails #129

Closed torgeirl closed 7 months ago

torgeirl commented 1 year ago

When switching from Django Storages (S3) to WhiteNoise for static files it gives a MissingFileError for one font:

The CSS file 'cradmin_legacy/dist/vendor/fonts/fontawesome/css/font-awesome.css' references a file which could not be found:
  cradmin_legacy/dist/vendor/fonts/fontawesome/fonts/fontawesome-webfont.eot

The font is there so I assume there issue is caused by how it is being referenced:

The most common issue is that there are CSS files which reference other files (usually images or fonts) which don’t exist at that specified path. When Django attempts to rewrite these references it looks for the corresponding file and throws an error if it can’t find it.

(WhiteNoise documentation)

Edit: the Whitenoise backend without caching ('whitenoise.storage.CompressedStaticFilesStorage') works fine.

torgeirl commented 7 months ago

Looking more into this I realize there are certain aspects with WhiteNoise's caching that would create issues when being served by multiple hosts behind a load balancer, and while it might still be beneficial to clean up file referencing in our static files we don't need it for this particular use-case.