Settings

djangocms-rest is configured almost entirely through django CMS, Django and third-party settings. It defines one setting of its own; the rest of this page lists the existing settings that change how the API behaves, with pointers to the guides that use them.

Settings defined by djangocms-rest

REST_JSON_RENDERING

Type:

bool

Default:

not CMS_TEMPLATES — i.e. True when no classic CMS_TEMPLATES are configured (a headless install), False otherwise.

Controls whether django CMS renders content as JSON in the editing UI (the toolbar / structure board), using the package’s RESTRenderer. When enabled, djangocms-rest also disables djangocms-text’s inline editing (TEXT_INLINE_EDITING), since rich text is delivered as data rather than edited in place.

Important

This setting affects only what editors see inside django CMS. It does not change the REST API responses — content endpoints always return serialized JSON regardless of its value.

Set it explicitly to override the default — for example, to keep JSON rendering on in a project that still defines CMS_TEMPLATES:

# settings.py
REST_JSON_RENDERING = True

See Headless django CMS for the editing-and-preview model this fits into.

Django CMS settings that affect the API

These are standard django CMS settings; djangocms-rest reads them rather than defining them.

Setting

Effect on djangocms-rest

CMS_LANGUAGES

Drives the /api/languages/ endpoint and per-language content resolution, including public, fallbacks and hide_untranslated. See Configure languages.

CMS_TEMPLATES

Its presence is the default basis for REST_JSON_RENDERING.

CMS_PLACEHOLDER_CONF

Declares placeholder slots and constraints; reflected by the placeholder endpoint (/placeholders/…).

CMS_CACHE_DURATIONS

The "content" duration caps how long serialized placeholder content is cached. See Caching and performance.

Django settings that affect the API

Setting

Effect on djangocms-rest

LANGUAGES / LANGUAGE_CODE / USE_I18N

Standard Django i18n, configured alongside CMS_LANGUAGES (Configure languages).

SITE_ID + django.contrib.sites

The fallback site when no X-Site-ID header is sent, and the basis for multi-site scoping. See Serve multiple sites from one instance.

CACHES

The Django cache backend used to store serialized placeholder content (Caching and performance).

CSRF_TRUSTED_ORIGINS, SESSION_COOKIE_SAMESITE, SESSION_COOKIE_SECURE, CSRF_COOKIE_SAMESITE, CSRF_COOKIE_SECURE

Required for cross-origin, session-authenticated preview requests. See Access draft (preview) content.

Third-party settings

Setting

Effect on djangocms-rest

CORS_ALLOWED_ORIGINS, CORS_ALLOW_HEADERS, CORS_ALLOW_CREDENTIALS

From django-cors-headers; needed for browser frontends and for the X-Site-ID header. See Enable CORS for a decoupled frontend.

REST_FRAMEWORK

Django REST framework configuration. Set DEFAULT_SCHEMA_CLASS to enable OpenAPI generation (Generate the OpenAPI schema and a typed client).

SPECTACULAR_SETTINGS

drf-spectacular schema/documentation options (optional).

TEXT_INLINE_EDITING

From djangocms-text. Forced to False when REST_JSON_RENDERING is active.

Middleware

djangocms_rest.middleware.SiteContextMiddleware is not a setting but is added to MIDDLEWARE to resolve the X-Site-ID request header for single-instance multi-site deployments. See Serve multiple sites from one instance.