Skip to content

Commit 60d167f

Browse files
author
Michael Davis
committed
Fix issue where compiled file not found in S3 as built locally
jazzband#475
1 parent b9a48bd commit 60d167f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pipeline/compressors/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from itertools import takewhile
1010

11+
from django.contrib.staticfiles import finders
1112
from django.contrib.staticfiles.storage import staticfiles_storage
1213
from django.utils.encoding import smart_bytes, force_text
1314
try:
@@ -216,7 +217,12 @@ def relative_path(self, absolute_path, output_filename):
216217

217218
def read_bytes(self, path):
218219
"""Read file content in binary mode"""
219-
file = staticfiles_storage.open(path)
220+
finder_path = finders.find(path)
221+
if finder_path is not None:
222+
file = open(finder_path)
223+
else:
224+
raise Exception("File '%s' not found via "
225+
"static files finders", path)
220226
content = file.read()
221227
file.close()
222228
return content

0 commit comments

Comments
 (0)