forked from django-compressor/django-compressor
/
staticfiles.py
29 lines (24 loc) · 1.05 KB
/
staticfiles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from __future__ import absolute_import
from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured
INSTALLED = "staticfiles" in django_settings.INSTALLED_APPS or \
"django.contrib.staticfiles" in django_settings.INSTALLED_APPS
finders = None
settings = None
if INSTALLED:
if "django.contrib.staticfiles" in django_settings.INSTALLED_APPS:
from django.contrib.staticfiles import finders
settings = django_settings
else:
try:
from staticfiles import finders
from staticfiles.conf import settings
except ImportError:
# Old (pre 1.0) and incompatible version of staticfiles
INSTALLED = False
if INSTALLED and "compressor.finders.CompressorFinder" \
not in settings.STATICFILES_FINDERS:
raise ImproperlyConfigured(
"When using Django Compressor together with staticfiles, "
"please add 'compressor.finders.CompressorFinder' to the "
"STATICFILES_FINDERS setting.")