107 lines
2.7 KiB
Plaintext
107 lines
2.7 KiB
Plaintext
Quickstart
|
|
==========
|
|
|
|
Installation
|
|
------------
|
|
|
|
* Install Django Compressor with your favorite Python package manager::
|
|
|
|
pip install django_compressor
|
|
|
|
* Add ``'compressor'`` to your ``INSTALLED_APPS`` setting::
|
|
|
|
INSTALLED_APPS = (
|
|
# other apps
|
|
"compressor",
|
|
)
|
|
|
|
* See the list of :ref:`settings` to modify Django Compressor's
|
|
default behaviour and make adjustments for your website.
|
|
|
|
* In case you use Django 1.3'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``:
|
|
|
|
.. code-block:: python
|
|
|
|
STATICFILES_FINDERS = (
|
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
# other finders..
|
|
'compressor.finders.CompressorFinder',
|
|
)
|
|
|
|
.. _staticfiles: http://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/
|
|
.. _django-staticfiles: http://pypi.python.org/pypi/django-staticfiles
|
|
|
|
.. _dependencies:
|
|
|
|
Dependencies
|
|
------------
|
|
|
|
Required
|
|
^^^^^^^^
|
|
|
|
In case you're installing Django Compressor differently
|
|
(e.g. from the Git repo), make sure to install the following
|
|
dependencies.
|
|
|
|
- django-appconf_
|
|
|
|
Used internally to handle Django's settings, this is
|
|
automatically installed when following the above
|
|
installation instructions.
|
|
|
|
pip install django-appconf
|
|
|
|
- versiontools_
|
|
|
|
Used internally to handle versions better, this is
|
|
automatically installed when following the above
|
|
installation instructions.
|
|
|
|
In case you're installing Django Compressor differently
|
|
(e.g. from the Git repo), make sure to install it, e.g.::
|
|
|
|
pip install versiontools
|
|
|
|
Optional
|
|
^^^^^^^^
|
|
|
|
- BeautifulSoup_
|
|
|
|
For the :attr:`parser <django.conf.settings.COMPRESS_PARSER>`
|
|
``compressor.parser.BeautifulSoupParser`` and
|
|
``compressor.parser.LxmlParser``::
|
|
|
|
pip install "BeautifulSoup<4.0"
|
|
|
|
- lxml_
|
|
|
|
For the :attr:`parser <django.conf.settings.COMPRESS_PARSER>`
|
|
``compressor.parser.LxmlParser``, also requires libxml2_::
|
|
|
|
STATIC_DEPS=true pip install lxml
|
|
|
|
- html5lib_
|
|
|
|
For the :attr:`parser <django.conf.settings.COMPRESS_PARSER>`
|
|
``compressor.parser.Html5LibParser``::
|
|
|
|
pip install html5lib
|
|
|
|
- `Slim It`_
|
|
|
|
For the :ref:`Slim It filter <slimit_filter>`
|
|
``compressor.filters.jsmin.SlimItFilter``::
|
|
|
|
pip install slimit
|
|
|
|
.. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/
|
|
.. _lxml: http://codespeak.net/lxml/
|
|
.. _libxml2: http://xmlsoft.org/
|
|
.. _html5lib: http://code.google.com/p/html5lib/
|
|
.. _`Slim It`: http://slimit.org/
|
|
.. _django-appconf: http://pypi.python.org/pypi/django-appconf/
|
|
.. _versiontools: http://pypi.python.org/pypi/versiontools/ |