Installation¶
Add the
django-anchorpackage to your dependencies. You can do this by running:pip install django-anchor
or by adding
django-anchorto yourrequirements.txtorpyproject.tomlfiles if you have one.If you intend to transform images you’ll also need to install
Pillow. See below for more details.Add
anchortosettings.INSTALLED_APPSAdd URL configuration to your project:
urlpatterns = [ path('anchor/', include('anchor.urls')), ]
Run migrations:
python manage.py migrate
By default, Anchor works with your default storage backend. If you want to use a
different storage backend, define it under STORAGES in your project settings
and set ANCHOR['DEFAULT_STORAGE_BACKEND'] to the name of your preferred
storage backend.
Check out the full configuration options in configuration.
Additional dependencies for image transformations¶
Using Anchor to generate representations of images requires the Pillow
Python package. You can add it to your dependencies, and there’s no need to add
anything to the INSTALLED_APPS setting.
Keep in mind that while Pillow is a powerful library with lots of available
operations, Anchor only supports a handful of them. Check out the
PillowProcessor documentation for a list of supported
operations.