# Settings

`Unicorn` stores all settings in a dictionary under the `UNICORN` attribute in the Django settings file. All settings are optional.

```python
# settings.py
UNICORN = {
    "APPS": ["unicorn",],
    "CACHE_ALIAS": "default",
    "MINIFY_HTML": False,
    "MINIFIED": True,
    "SERIAL": {
        "ENABLED": False,
        "TIMEOUT": 60,
    },
    "SCRIPT_LOCATION": "after",
    "MORPHER": {
        "NAME": "morphdom",
        "RELOAD_SCRIPT_ELEMENTS": False,
    },
}
```

## APPS

Specify the modules to look for components. Defaults to `["unicorn",]`.

## CACHE_ALIAS

The alias to use for caching. Only used by the experimental serialization of requests for now. Defaults to `"default"`.

## MINIFY_HTML

Minify the HTML generated by `Unicorn` in the AJAX request. If set to `True` and [`htmlmin`](https://pypi.org/project/htmlmin/) is installed HTML will be minified. `htmlmin` can be installed with `Unicorn` via `uv add django-unicorn[minify]` or `pip install django-unicorn[minify]`. Defaults to `False`.

## MINIFIED

Provides a way to control if the minified version of the JavaScript bundle (i.e. `unicorn.min.js`) is used. Defaults to `!DEBUG`.

## SERIAL

Settings for the experimental serialization of requests. Defaults to `{}`.

### ENABLED

Whether slow requests to the same component should be queued or not. Defaults to `False`.

### TIMEOUT

The number of seconds to wait for a request to finish for additional requests to queue behind it. Defaults to `60`.

## SCRIPT_LOCATION

Where the initial JavaScript data is included on initial render. Two values are currently supported: `after` and `append`.

**after** is the default and will render the JavaScript _outside_ of the HTML component, i.e. it will be output in the same hierarchy as the parent of the HTML component.

**append** will render the JavaScript _inside_ of the HTML component.

## MORPHER

Configures the library to use for diffing and merging the DOM. Defaults to `{}`.

### NAME

The name of the morpher to use. Defaults to `"morphdom"`. Specify `"alpine"` to use the [Alpine.js Morph Plugin](https://alpinejs.dev/plugins/morph). See [Custom Morphers](custom-morphers.md) for more information.

### RELOAD_SCRIPT_ELEMENTS

Whether script elements should be reloaded when a component is re-rendered. Defaults to `False`. Only available with the `"morphdom"` morpher.
