django-cors-headers is a Django app that adds Cross-Origin Resource Sharing (CORS) headers to responses, allowing in-browser requests to your Django application from other origins.
The tool solves the problem of enabling cross-origin requests by handling the server headers required by the CORS specification. It works as middleware that intercepts responses and adds the appropriate CORS headers based on your configuration, allowing browsers to permit requests from specified origins to access your Django application's resources.
You should adopt this tool if you are building a Django application that needs to serve requests from browsers on different domains or subdomains. It suits any project where a frontend running on a separate origin needs to make requests to your Django backend. The README emphasizes understanding CORS security implications before use, as enabling CORS headers can expose private data if misconfigured. The tool requires Python 3.10 or later and Django 5.2 or later. Installation involves adding the app to INSTALLED_APPS and placing the CorsMiddleware early in your middleware stack, before any middleware that generates responses.
The project maintains complete test coverage and uses code style enforcement with black and pre-commit hooks. Development activity shows consistent attention to quality standards and compatibility maintenance across supported Python and Django versions.