Skip to content

Commit 59725b3

Browse files
authored
Use hashed static files (#12274)
Attempt to fix readthedocs/readthedocs-ops#1650
1 parent f3447bf commit 59725b3

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

readthedocs/settings/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ def MIDDLEWARE(self):
409409
RTD_BUILD_COMMANDS_STORAGE = (
410410
"readthedocs.builds.storage.BuildMediaFileSystemStorage"
411411
)
412+
# This is for serving static files on proxito, not Django static files
413+
# https://github.com/readthedocs/readthedocs.org/pull/9237
412414
RTD_STATICFILES_STORAGE = "readthedocs.builds.storage.StaticFilesStorage"
413415

414416
@property
@@ -1058,7 +1060,7 @@ def STORAGES(self):
10581060
# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html
10591061
return {
10601062
"staticfiles": {
1061-
"BACKEND": self.RTD_STATICFILES_STORAGE,
1063+
"BACKEND": "readthedocs.storage.s3_storage.S3StaticStorage"
10621064
},
10631065
}
10641066

readthedocs/settings/docker_compose.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ def DATABASES(self): # noqa
177177
# Storage backend for build languages
178178
RTD_BUILD_TOOLS_STORAGE = "readthedocs.storage.s3_storage.S3BuildToolsStorage"
179179
# Storage for static files (those collected with `collectstatic`)
180-
STATICFILES_STORAGE = "readthedocs.storage.s3_storage.S3StaticStorage"
181180
RTD_STATICFILES_STORAGE = "readthedocs.storage.s3_storage.NoManifestS3StaticStorage"
182181

183182
AWS_ACCESS_KEY_ID = os.environ.get("RTD_AWS_ACCESS_KEY_ID", "admin")

readthedocs/settings/test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,18 @@ def LOGGING(self): # noqa - avoid pep8 N802
130130
logging["disable_existing_loggers"] = False
131131
return logging
132132

133+
@property
134+
def STORAGES(self):
135+
# Attempt to fix tests using the default storage backends
136+
return {
137+
"default": {
138+
"BACKEND": "django.core.files.storage.FileSystemStorage",
139+
},
140+
"staticfiles": {
141+
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
142+
},
143+
}
144+
145+
133146

134147
CommunityTestSettings.load_settings(__name__)

0 commit comments

Comments
 (0)