Skip to content

Commit ad9e8cf

Browse files
committed
Fixing static files for s3 hosting
1 parent b2f3538 commit ad9e8cf

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

main/settings.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"django.contrib.auth.middleware.AuthenticationMiddleware",
5858
"django.contrib.messages.middleware.MessageMiddleware",
5959
"django.middleware.clickjacking.XFrameOptionsMiddleware",
60-
'whitenoise.middleware.WhiteNoiseMiddleware',
6160
]
6261

6362
ROOT_URLCONF = "main.urls"
@@ -159,14 +158,14 @@
159158
USE_L10N = True
160159
USE_TZ = True
161160

162-
STATICFILES_LOCATION = "static"
163-
STATIC_URL = "/static/"
161+
STATICFILES_LOCATION = 'static'
162+
STATIC_URL = os.environ.get("STATIC_URL", "static/")
163+
STATIC_ROOT = os.environ.get("STATIC_ROOT",
164+
os.path.join(BASE_DIR, "staticfiles"))
164165
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"), ]
165-
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
166-
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
167166

168167
MEDIAFILES_LOCATION = "media"
169-
MEDIA_URL = "/media/"
168+
MEDIA_URL = os.environ.get("MEDIA_URL", "/media/")
170169
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
171170
SLACK_ENABLED = os.environ.get("SLACK_ENABLED") == 'True'
172171

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,3 @@ traitlets==5.0.5
5555
urllib3==1.25.10
5656
wcwidth==0.2.5
5757
webencodings==0.5.1
58-
whitenoise==5.2.0

0 commit comments

Comments
 (0)