Ethra8 / candlelight-worlds

0 stars 2 forks source link

Once deployed to Heroku, Bootstrap classes are not reflected, nor is the custom css file (static files) #6

Closed Ethra8 closed 1 month ago

Ethra8 commented 1 month ago

image

Ethra8 commented 1 month ago
  1. I have installed whitenoise pip install whitenoise
  2. In settings.py file, I have included 'whitenoise.middleware.WhiteNoiseMiddleware' to middlewares config
  3. Add STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
  4. Command on terminal: python manage.py collectstatic
  5. Push to github

image

Ethra8 commented 1 month ago

Further on the development of the site, I re-encountere the same issue, and a tutor helped me solve the issue, which apparently is related to Django 5.1 changes, so the settings.py file was updated as follows:


# DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
# # Optional, for static files
# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# All the above replaced in Django 5.1 to 'STORAGES':
STORAGES = {
    "default": {
        "BACKEND": "cloudinary_storage.storage.MediaCloudinaryStorage",
    },
    "staticfiles": {"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage"},
}```