Merge pull request #525 from diox/remove-old-staticfiles

Remove compatibility with old 'staticfiles' app
This commit is contained in:
Mathieu Pillard
2015-03-19 14:23:35 +01:00
4 changed files with 17 additions and 24 deletions

View File

@@ -19,12 +19,19 @@ DATABASES = {
}
INSTALLED_APPS = [
'django.contrib.staticfiles',
'compressor',
'coffin',
]
if django.VERSION < (1, 8):
INSTALLED_APPS.append('jingo')
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
]
STATIC_URL = '/static/'

View File

@@ -4,20 +4,10 @@ from django.core.exceptions import ImproperlyConfigured
from compressor.conf import settings
INSTALLED = ("staticfiles" in settings.INSTALLED_APPS or
"django.contrib.staticfiles" in settings.INSTALLED_APPS)
if "django.contrib.staticfiles" in settings.INSTALLED_APPS:
from django.contrib.staticfiles import finders # noqa
if INSTALLED:
if "django.contrib.staticfiles" in settings.INSTALLED_APPS:
from django.contrib.staticfiles import finders
else:
try:
from staticfiles import finders # noqa
except ImportError:
# Old (pre 1.0) and incompatible version of staticfiles
INSTALLED = False
if (INSTALLED and "compressor.finders.CompressorFinder"
if ("compressor.finders.CompressorFinder"
not in settings.STATICFILES_FINDERS):
raise ImproperlyConfigured(
"When using Django Compressor together with staticfiles, "

View File

@@ -18,10 +18,8 @@ Installation
* See the list of :ref:`settings` to modify Django Compressor's
default behaviour and make adjustments for your website.
* In case you use Django's staticfiles_ contrib app (or its standalone
counterpart django-staticfiles_) you have to add Django Compressor's file
finder to the ``STATICFILES_FINDERS`` setting, for example with
``django.contrib.staticfiles``:
* In case you use Django's staticfiles_ contrib app you have to add Django
Compressor's file finder to the ``STATICFILES_FINDERS`` setting, like this:
.. code-block:: python

View File

@@ -39,12 +39,11 @@ The storage backend to save the compressed files needs to be changed, too::
Using staticfiles
^^^^^^^^^^^^^^^^^
If you are using Django's staticfiles_ contrib app or the standalone
app django-staticfiles_, you'll need to use a temporary filesystem cache
for Django Compressor to know which files to compress. Since staticfiles
provides a management command to collect static files from various
locations which uses a storage backend, this is where both apps can be
integrated.
If you are using Django's staticfiles_ contrib app, you'll need to use a
temporary filesystem cache for Django Compressor to know which files to
compress. Since staticfiles provides a management command to collect static
files from various locations which uses a storage backend, this is where both
apps can be integrated.
#. Make sure the :attr:`~django.conf.settings.COMPRESS_ROOT` and STATIC_ROOT_
settings are equal since both apps need to look at the same directories
@@ -84,7 +83,6 @@ integrated.
.. _Amazon S3: https://s3.amazonaws.com/
.. _boto: http://boto.cloudhackers.com/
.. _django-storages: http://code.welldev.org/django-storages/
.. _django-staticfiles: http://github.com/jezdez/django-staticfiles/
.. _staticfiles: http://docs.djangoproject.com/en/dev/howto/static-files/
.. _STATIC_ROOT: http://docs.djangoproject.com/en/dev/ref/settings/#static-root
.. _STATIC_URL: http://docs.djangoproject.com/en/dev/ref/settings/#static-url