Merge pull request #525 from diox/remove-old-staticfiles
Remove compatibility with old 'staticfiles' app
This commit is contained in:
@@ -19,12 +19,19 @@ DATABASES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.staticfiles',
|
||||||
'compressor',
|
'compressor',
|
||||||
'coffin',
|
'coffin',
|
||||||
]
|
]
|
||||||
if django.VERSION < (1, 8):
|
if django.VERSION < (1, 8):
|
||||||
INSTALLED_APPS.append('jingo')
|
INSTALLED_APPS.append('jingo')
|
||||||
|
|
||||||
|
STATICFILES_FINDERS = [
|
||||||
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||||
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||||
|
'compressor.finders.CompressorFinder',
|
||||||
|
]
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,20 +4,10 @@ from django.core.exceptions import ImproperlyConfigured
|
|||||||
|
|
||||||
from compressor.conf import settings
|
from compressor.conf import settings
|
||||||
|
|
||||||
INSTALLED = ("staticfiles" in settings.INSTALLED_APPS or
|
if "django.contrib.staticfiles" in settings.INSTALLED_APPS:
|
||||||
"django.contrib.staticfiles" in settings.INSTALLED_APPS)
|
from django.contrib.staticfiles import finders # noqa
|
||||||
|
|
||||||
if INSTALLED:
|
if ("compressor.finders.CompressorFinder"
|
||||||
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"
|
|
||||||
not in settings.STATICFILES_FINDERS):
|
not in settings.STATICFILES_FINDERS):
|
||||||
raise ImproperlyConfigured(
|
raise ImproperlyConfigured(
|
||||||
"When using Django Compressor together with staticfiles, "
|
"When using Django Compressor together with staticfiles, "
|
||||||
|
@@ -18,10 +18,8 @@ Installation
|
|||||||
* See the list of :ref:`settings` to modify Django Compressor's
|
* See the list of :ref:`settings` to modify Django Compressor's
|
||||||
default behaviour and make adjustments for your website.
|
default behaviour and make adjustments for your website.
|
||||||
|
|
||||||
* In case you use Django's staticfiles_ contrib app (or its standalone
|
* In case you use Django's staticfiles_ contrib app you have to add Django
|
||||||
counterpart django-staticfiles_) you have to add Django Compressor's file
|
Compressor's file finder to the ``STATICFILES_FINDERS`` setting, like this:
|
||||||
finder to the ``STATICFILES_FINDERS`` setting, for example with
|
|
||||||
``django.contrib.staticfiles``:
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
@@ -39,12 +39,11 @@ The storage backend to save the compressed files needs to be changed, too::
|
|||||||
Using staticfiles
|
Using staticfiles
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
If you are using Django's staticfiles_ contrib app or the standalone
|
If you are using Django's staticfiles_ contrib app, you'll need to use a
|
||||||
app django-staticfiles_, you'll need to use a temporary filesystem cache
|
temporary filesystem cache for Django Compressor to know which files to
|
||||||
for Django Compressor to know which files to compress. Since staticfiles
|
compress. Since staticfiles provides a management command to collect static
|
||||||
provides a management command to collect static files from various
|
files from various locations which uses a storage backend, this is where both
|
||||||
locations which uses a storage backend, this is where both apps can be
|
apps can be integrated.
|
||||||
integrated.
|
|
||||||
|
|
||||||
#. Make sure the :attr:`~django.conf.settings.COMPRESS_ROOT` and STATIC_ROOT_
|
#. 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
|
settings are equal since both apps need to look at the same directories
|
||||||
@@ -84,7 +83,6 @@ integrated.
|
|||||||
.. _Amazon S3: https://s3.amazonaws.com/
|
.. _Amazon S3: https://s3.amazonaws.com/
|
||||||
.. _boto: http://boto.cloudhackers.com/
|
.. _boto: http://boto.cloudhackers.com/
|
||||||
.. _django-storages: http://code.welldev.org/django-storages/
|
.. _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/
|
.. _staticfiles: http://docs.djangoproject.com/en/dev/howto/static-files/
|
||||||
.. _STATIC_ROOT: http://docs.djangoproject.com/en/dev/ref/settings/#static-root
|
.. _STATIC_ROOT: http://docs.djangoproject.com/en/dev/ref/settings/#static-root
|
||||||
.. _STATIC_URL: http://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
.. _STATIC_URL: http://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
||||||
|
Reference in New Issue
Block a user