Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Django Headless

PyPI version Python versions Django versions License

With Django Headless you quickly create a REST API for your models, making it easy to turn Django into a powerful headless CMS.

📖 Read the full documentation at djangoheadless.org

✨ Features

  • 🎯 Easy configuration: Add @expose decorator to any model and get instant REST endpoints
  • 🤝 Plays nice: Seamlessly integrates with existing Django applications
  • 💈 Supports singletons: Special handling for singleton models (settings, configurations, etc.)
  • 🔍 Flexible filtering: Filtering backend based on Django ORM lookups, enabled by default
  • 🛡️ Secure by default: Generated routes require authentication until you open them up

🚀 Quick Start

Install the package:

pip install django-headless

Add headless to INSTALLED_APPS:

# settings.py
INSTALLED_APPS = [
    # ...
    "rest_framework",
    "headless",
]

Expose a model:

# apps/blog/models.py
from django.db import models
from headless import expose


@expose()
class BlogPost(models.Model):
    title = models.CharField(max_length=200)
    content = models.TextField()
    published = models.BooleanField(default=False)
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.title

Include the URLs:

# urls.py
from django.urls import path, include

urlpatterns = [
    # ...
    path("api/", include("headless.rest.urls")),
]

That's it! 🎉 Your model is now available via REST API at /api/blog.blogpost

Note: generated routes answer 403 for unauthenticated requests by default, so freshly exposed models are never accidentally public. See the permissions documentation to open routes up.

📚 Documentation

All usage and configuration is documented at djangoheadless.org:

  • Installation — requirements, setup and first steps
  • Exposing models — all @expose() options: singletons, field control, read-only models
  • Singletons — single-instance resources like site settings
  • Filtering — ORM lookups, exclusions and type casting
  • Pagination — the read-friendly pagination envelope
  • Authentication — secret key authentication and DRF classes
  • Permissions — safe defaults and route-scoped overrides
  • Serializers — serializer customization, field expansion and model properties
  • Settings reference — every HEADLESS option

🤝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for your changes
  5. Run the test suite (poetry run test)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

Development Setup

# Clone the repository
git clone https://github.com/dwarsbit/django-headless.git
cd django-headless

# Install dependencies (Poetry creates the virtual environment)
poetry install

# Run tests
poetry run test

🐛 Issues & Support

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built on the shoulders of Django and Django REST Framework
  • Inspired by the headless CMS and Jamstack movement
  • Thanks to all contributors and the Django community

Metadata

Release files for django-headless 1.0.0rc8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-headless 1.0.0rc8
File Size Uploaded
django_headless-1.0.0rc8.tar.gz 19.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-headless 1.0.0rc8
File Interpreter ABI Platform
django_headless-1.0.0rc8-py3-none-any.whl Python 3 none any Details

Total release size: 45.7 kB

Release files / django_headless-1.0.0rc8.tar.gz

Download URL django_headless-1.0.0rc8.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
65db90d2111d6d44bbe0da2c996545c483fe0cd885ece8df0e6f8736234f6e01
BLAKE2b-256 checksum
How to use checksums
87647e8cf52b71b70e041771fc5129a40da4eaf15e59e08c6212e0b78b694be5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.7 Darwin/27.0.0

Release files / django_headless-1.0.0rc8-py3-none-any.whl

Download URL django_headless-1.0.0rc8-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
611468b8d07030f47553e3c8f0e5ddc318f9f954a79fbacd06bab9760f7386e9
BLAKE2b-256 checksum
How to use checksums
c0884423650ee135b5dd8e73a7e0c9edb3b7af26b55f0c7bd9564968723d1040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.7 Darwin/27.0.0
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page