-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix static files for container images/Debian packages when DEBUG is o…
…n (1.15) (#2788) Co-authored-by: Jan Klopper <[email protected]>
- Loading branch information
1 parent
0514e93
commit 2b9d052
Showing
4 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.conf import settings | ||
from whitenoise.storage import CompressedManifestStaticFilesStorage | ||
|
||
|
||
class RockyStaticFilesStorage(CompressedManifestStaticFilesStorage): | ||
def url(self, name, force=False): | ||
if settings.DEBUG and settings.COMPRESS_ENABLED: | ||
# If django-compressor is enabled when DEBUG is also enabled, we | ||
# need to force Django to use the hashed urls so that | ||
# django-compressor can find the static assets in the offline | ||
# manifest. This is needed to make it possible to use DEBUG with | ||
# container images or Debian packages where we only ship the hashed | ||
# files. | ||
force = True | ||
|
||
return super().url(name, force) |