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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
.. _settings:
Configuration
=============
Settings
--------
.. currentmodule:: django.conf.settings
.. attribute:: IMAGEKIT_DEFAULT_THUMBNAIL_FORMAT
:default: ``None``
The output format of the images generated by the ``thumbnail`` template tag.
.. attribute:: IMAGEKIT_CACHEFILE_DIR
:default: ``'CACHE/images'``
The directory to which image files will be cached.
.. attribute:: IMAGEKIT_DEFAULT_THUMBNAIL_SRCSET_SCALES
:default: ``None``
A list of scale factors, for example ``[2, 3]``. If specified, every
``<img>`` generated by the ``thumbnail`` template tag will have a ``srcset``
attribute with the given scales. To prevent this, set ``srcset=None``.
.. attribute:: IMAGEKIT_DEFAULT_FILE_STORAGE
:default: ``None``
Starting with Django 4.2, if you defined ``settings.STORAGES``:
the Django storage backend alias to retrieve the storage instance defined
in your settings, as described in the `Django file storage documentation`_.
If no value is provided for ``IMAGEKIT_DEFAULT_FILE_STORAGE``,
and none is specified by the spec definition, the ``default`` file storage
will be used.
Before Django 4.2, or if ``settings.STORAGES`` is not defined:
The qualified class name of a Django storage backend to use to save the
cached images. If no value is provided for ``IMAGEKIT_DEFAULT_FILE_STORAGE``,
and none is specified by the spec definition, `your default file storage`__
will be used.
.. _`Django file storage documentation`: https://docs.djangoproject.com/en/dev/ref/files/storage/
.. attribute:: IMAGEKIT_DEFAULT_CACHEFILE_BACKEND
:default: ``'imagekit.cachefiles.backends.Simple'``
Specifies the class that will be used to validate cached image files.
.. attribute:: IMAGEKIT_DEFAULT_CACHEFILE_STRATEGY
:default: ``'imagekit.cachefiles.strategies.JustInTime'``
The class responsible for specifying how and when cache files are
generated.
.. attribute:: IMAGEKIT_CACHE_BACKEND
:default: ``'default'``
The Django cache backend alias to retrieve the shared cache instance defined
in your settings, as described in the `Django cache section`_.
The cache is then used to store information like the state of cached
images (i.e. validated or not).
.. _`Django cache section`: https://docs.djangoproject.com/en/dev/topics/cache/#accessing-the-cache
.. attribute:: IMAGEKIT_CACHE_TIMEOUT
:default: ``None``
Use when you need to override the timeout used to cache file state.
By default it is "cache forever".
It's highly recommended that you use a very high timeout.
.. attribute:: IMAGEKIT_CACHE_PREFIX
:default: ``'imagekit:'``
A cache prefix to be used when values are stored in ``IMAGEKIT_CACHE_BACKEND``
.. attribute:: IMAGEKIT_CACHEFILE_NAMER
:default: ``'imagekit.cachefiles.namers.hash'``
A function responsible for generating file names for non-spec cache files.
.. attribute:: IMAGEKIT_SPEC_CACHEFILE_NAMER
:default: ``'imagekit.cachefiles.namers.source_name_as_path'``
A function responsible for generating file names for cache files that
correspond to image specs. Since you will likely want to base the name of
your cache files on the name of the source, this extra setting is provided.
__ https://docs.djangoproject.com/en/dev/ref/settings/#default-file-storage
|