Whitenoise + Django + Cloudfoundry - http 500 when compression is enabled

I have successfully deployed Django from Whitenoise to Cloudfoundry, with the exception of compression. If I turned on settings.py to enable compression:

 STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' 

I get a 500 error and nothing on cf logs . Please, not that I did not have access to SSH and / heroku, as this works on Predix .

My settings.py :

 STATIC_URL = "/media/" STATIC_ROOT = os.path.join(BASE_DIR, "media") STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'itcave/media'), ] MIDDLEWARE_CLASSES = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] 

wsgi.py

 from whitenoise.django import DjangoWhiteNoise from django.core.wsgi import get_wsgi_application import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "itcave.settings") application = get_wsgi_application() application = DjangoWhiteNoise(application) 

Also note that all of my static files are stored in the media folder at the same level as my settings.py file.

Adding web: python itcave/manage.py collectstatic --noinput to a string before my launch command in Procfile didn't work. ALLOWED_HOSTS is correct, because when DEBUG = True everything works fine.

+5
source share

All Articles