My code with django-compressor works on my local machine with DEBUG=True or False, but when I push to production, which is a Windows Server 2019 served by IIS, then it only works with DEBUG=True. If I set to False, then I get this error: OfflineGenerationError: You have offline compression enabled but key is missing from offline manifest.
I have looked at many different other posts regarding this same issue but none solve it for me so far. Here are my details:
I am using pipenv
[requires]
python_version = "3.8"
[packages]
django = "3.1.2"
django-compressor = "2.4"
whitenoise = "5.2.0" {extras = ["brotli"], version = "1.0.9"}
wfastcgi = "3.0.0"
Production Details
Windows Server 2019
IIS for 2019
settings.py
INSTALLED_APPS = [
...
'whitenoise.runserver_nostatic',
'django.contrib.staticfiles',
'compressor',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
...
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/assets/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'assets')
]
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
COMPRESS_STORAGE = "compressor.storage.GzipCompressorFileStorage"
COMPRESS_FILTERS = {
"css": [
"compressor.filters.css_default.CssAbsoluteFilter",
"compressor.filters.cssmin.rCSSMinFilter",
],
"js": ["compressor.filters.jsmin.JSMinFilter"],
}
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
WHITENOISE_MAX_AGE = 31536000 if not DEBUG else 0 # 1 year
COMPRESS_ENABLED = True
COMPRESS_OFFLINE = True
Any thoughts on how I can debug why it won't work with DEBUG = False, but works in all other 3 situations.
One more thing I will throw out, I don't have SSL setup yet on production, could this be the cause of it not working? I thought I read somewhere of something only delivering cached something if it was an SSL call.