summaryrefslogtreecommitdiff
path: root/django_pyscss/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'django_pyscss/utils.py')
-rw-r--r--django_pyscss/utils.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/django_pyscss/utils.py b/django_pyscss/utils.py
index 1f9e4b4..e4222c0 100644
--- a/django_pyscss/utils.py
+++ b/django_pyscss/utils.py
@@ -1,7 +1,6 @@
import fnmatch
import os
-from django.conf import settings
from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import staticfiles_storage
@@ -40,8 +39,10 @@ def get_file_from_finders(filename):
def get_file_and_storage(filename):
- # TODO: the switch probably shouldn't be on DEBUG
- if settings.DEBUG:
- return get_file_from_finders(filename)
- else:
- return get_file_from_storage(filename)
+ name, storage = get_file_from_finders(filename)
+ # get_file_from_finders could fail in production if code is a deployed as a
+ # package without it's package_data. In that case, we'd assume that
+ # collectstatic had been run and we can get the file from storage.
+ if storage is None:
+ name, storage = get_file_from_storage(filename)
+ return name, storage