Quickstart¶
Installation¶
Install Django Compressor with your favorite Python package manager:
pip install django_compressor
Add
'compressor'
to yourINSTALLED_APPS
setting:INSTALLED_APPS = ( # other apps "compressor", )
See the list of 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 withdjango.contrib.staticfiles
:STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', # other finders.. 'compressor.finders.CompressorFinder', )
Define
COMPRESS_ROOT
in settings if you don’t have alreadySTATIC_ROOT
or if you want it in a different folder.
Dependencies¶
Required¶
In case you’re installing Django Compressor differently (e.g. from the Git repo), make sure to install the following dependencies.
-
Used internally to handle Django’s settings, this is automatically installed when following the above installation instructions.
pip install django-appconf
Optional¶
-
For the
parser
compressor.parser.BeautifulSoupParser
andcompressor.parser.LxmlParser
:pip install "BeautifulSoup<4.0"
-
For the
parser
compressor.parser.LxmlParser
, also requires libxml2:STATIC_DEPS=true pip install lxml
-
For the
parser
compressor.parser.Html5LibParser
:pip install html5lib
-
For the Slim It filter
compressor.filters.jsmin.SlimItFilter
:pip install slimit