djangocms-rest enables frontend projects to consume django CMS content through a browsable, read-only REST/JSON API. Built on Django REST Framework (DRF) with OpenAPI 3 schema generation via drf-spectacular.
- Easy integration – Integrates effortlessly into existing Django CMS projects
- REST API – DRF-based API exposing Django CMS content for SPAs, static sites, and mobile apps
- Typed Endpoints – Auto-generate OpenAPI schemas for page data and plugin content
- Plugin Serialization – Basic support for all CMS plugins, easily extendable for custom needs
- Multi-Site Support – Serve multiple websites from a single instance with isolated API responses
- Multi-language Content – Use the robust i18n integration of Django CMS in your frontend
- Preview & Draft Access – Fetch unpublished or draft content in your frontend for editing previews
- Permissions & Authentication – Uses DRF and Django permissions for secure access control
- Menus & Breadcrumbs – Exposes the built-in navigation handlers from Django CMS
- Caching & Performance – Works with Django cache backends like Redis and Memcached
- Python >= 3.10, < 3.14
- Django >= 4.2, < 6.1
- Django CMS >= 4.1, < 5.1
Install using pip:
pip install djangocms-restUpdate your INSTALLED_APPS setting:
INSTALLED_APPS = [
...
"djangocms_rest",
...
]
rest_frameworkis installed as a dependency. Add it toINSTALLED_APPSif you want to use the browsable API UI or create additional DRF endpoints beyond djangocms-rest.
Add the API endpoints to your project's urls.py:
from django.urls import path, include
urlpatterns = [
...
path('api/', include('djangocms_rest.urls')),
...
]Using
api/cms/as the path helps separate djangocms-rest endpoints in API documentation and frontend implementation.
Make sure you have at least one published page, then make your first request:
curl http://localhost:8000/api/en/pages/This returns the home page with its placeholder content embedded as JSON. If rest_framework is in INSTALLED_APPS, you can also browse the API at http://localhost:8000/api/.
See the tutorial for a full walkthrough.
The full documentation is organised along the Diátaxis framework:
- Tutorial – a hands-on lesson from empty project to fetching real content
- How-to guides – CORS, multi-site, preview, OpenAPI schema, custom plugin serialization
- Reference – endpoint catalogue, conventions, settings (per-endpoint detail lives in the live OpenAPI schema)
- Explanation – headless mode, content model, preview & versioning, plugin serialization, multi-site, caching
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.