From 3a2f4d55d7d48eb168b01153aa50053cc20941bc Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:30:34 +0530 Subject: [PATCH] fix: static and media files storages (#1482) --- apiserver/plane/settings/production.py | 18 +++++++++++------- apiserver/plane/settings/staging.py | 17 +++++++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/apiserver/plane/settings/production.py b/apiserver/plane/settings/production.py index 7e76404f6..2e40c5998 100644 --- a/apiserver/plane/settings/production.py +++ b/apiserver/plane/settings/production.py @@ -70,8 +70,12 @@ CORS_ALLOW_HEADERS = [ ] CORS_ALLOW_CREDENTIALS = True -# Simplified static file serving. -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" + +STORAGES = { + "staticfiles": { + "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", + }, +} if bool(os.environ.get("SENTRY_DSN", False)): sentry_sdk.init( @@ -87,7 +91,7 @@ if bool(os.environ.get("SENTRY_DSN", False)): if DOCKERIZED and USE_MINIO: INSTALLED_APPS += ("storages",) - STORAGES = {"default": {"BACKEND": "storages.backends.s3boto3.S3Boto3Storage"}} + STORAGES["default"] = {"BACKEND": "storages.backends.s3boto3.S3Boto3Storage"} # The AWS access key to use. AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID", "access-key") # The AWS secret access key to use. @@ -188,7 +192,10 @@ else: # extra characters appended. AWS_S3_FILE_OVERWRITE = False - DEFAULT_FILE_STORAGE = "django_s3_storage.storage.S3Storage" + STORAGES["default"] = { + "BACKEND": "django_s3_storage.storage.S3Storage", + } + # AWS Settings End # Enable Connection Pooling (if desired) @@ -203,9 +210,6 @@ ALLOWED_HOSTS = [ ] -# Simplified static file serving. -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" - SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True diff --git a/apiserver/plane/settings/staging.py b/apiserver/plane/settings/staging.py index 5a43e266e..076bb3e3c 100644 --- a/apiserver/plane/settings/staging.py +++ b/apiserver/plane/settings/staging.py @@ -48,8 +48,12 @@ ALLOWED_HOSTS = ["*"] # TODO: Make it FALSE and LIST DOMAINS IN FULL PROD. CORS_ALLOW_ALL_ORIGINS = True -# Simplified static file serving. -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" +STORAGES = { + "staticfiles": { + "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", + }, +} + # Make true if running in a docker environment DOCKERIZED = int(os.environ.get( @@ -151,7 +155,9 @@ AWS_S3_SIGNATURE_VERSION = None AWS_S3_FILE_OVERWRITE = False # AWS Settings End - +STORAGES["default"] = { + "BACKEND": "django_s3_storage.storage.S3Storage", +} # Enable Connection Pooling (if desired) # DATABASES['default']['ENGINE'] = 'django_postgrespool' @@ -164,11 +170,6 @@ ALLOWED_HOSTS = [ "*", ] - -DEFAULT_FILE_STORAGE = "django_s3_storage.storage.S3Storage" -# Simplified static file serving. -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" - SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True