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.0rc9

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.0rc9
File Size Uploaded Provenance
django_headless-1.0.0rc9.tar.gz 20.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 45.9 kB

Release files / django_headless-1.0.0rc9.tar.gz

Download URL django_headless-1.0.0rc9.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
08d9527e82c34b7393c870e71dd257060e2bdf1809fa5b4247e041ebd4fca356
BLAKE2b-256 checksum
How to use checksums
3eb52027ecc0f172a781c1e7fd51a2b4c4a4f9b4902d9746833db8c0d8dfb82a
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.0rc9-py3-none-any.whl

Download URL django_headless-1.0.0rc9-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
773c9d783033b7f64ba94b5c96b73add75cda1c716ec80e8f7813e921e70e185
BLAKE2b-256 checksum
How to use checksums
dc6559eb456c0ea99e96cacac3f63c8d844645f2d5acd67fcbb0cc2303c2e395
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

Security for django-headless 1.0.0rc9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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