django-cors-headers
django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS).
Install
django-cors-headers on PyPI
pip
pip install django-cors-headersuv
uv add django-cors-headerspoetry
poetry add django-cors-headersPackage facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — asgiref, django |
| Maintenance | actively maintained — 329 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: django_cors_headers-4.9.0-py3-none-any.whl
Keywords: api, cors, django, middleware, rest
About django-cors-headers
from the package's own PyPI description — quoted content, verbatim
=================== django-cors-headers ===================
.. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/django-cors-headers/main.yml.svg?branch=main&style=for-the-badge :target: https://github.com/adamchainz/django-cors-headers/actions?workflow=CI
.. image:: https://img.shields.io/badge/Coverage-100%25-success?style=for-the-badge :target: https://github.com/adamchainz/django-cors-headers/actions?workflow=CI
.. image:: https://img.shields.io/pypi/v/django-cors-headers.svg?style=for-the-badge :target: https://pypi.org/project/django-cors-headers/
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge :target: https://github.com/psf/black
.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge :target: https://github.com/pre-commit/pre-commit :alt: pre-commit
A Django App that adds Cross-Origin Resource Sharing (CORS) headers to responses. This allows in-browser requests to your Django application from other origins.
Improve your Django and Git skills with my books <https://adamj.eu/books/>__.
About...
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
A Django middleware that adds Cross-Origin Resource Sharing (CORS) headers to HTTP responses, enabling in-browser requests to your Django application from other origins.
Installs with minimal friction as a pure Python wheel depending only on django and asgiref. Actively maintained with a recent release (2025-09-18) and last commit dated 2026-08-04 indicates ongoing development.
Licensed under MIT (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Usage
pip install django-cors-headers
# In settings.py
INSTALLED_APPS = [
"corsheaders",
]
MIDDLEWARE = [
"corsheaders.middleware.CorsMiddleware",
"django.middleware.common.CommonMiddleware",
]
CORS_ALLOWED_ORIGINS = ["https://example.com"]
CorsMiddleware must be placed early in the MIDDLEWARE list, before any middleware that generates responses (e.g., CommonMiddleware), or CORS headers will not be added.
Verdict: A production-ready, actively maintained Django middleware for CORS handling with zero known vulnerabilities, minimal dependencies, and permissive licensing. Well-suited for REST APIs and cross-origin scenarios, though requires careful configuration of allowed origins to avoid unintended security exposure.
Needs verification
- Whether the package's 100% test coverage claim (shown in description) is independently verified or self-reported
- Performance impact of the middleware on typical Django request/response cycles under load
Similar packages
permissive · top 1,000 on PyPI
regexpermissive · top 100 on PyPI
time-machinepermissive · top 1,000 on PyPI
opentelemetry-instrumentation-wsgipermissive · top 1,000 on PyPI
opentelemetry-instrumentation-asgipermissive · top 1,000 on PyPI
opentelemetry-util-httppermissive · top 1,000 on PyPI
respxpermissive · top 1,000 on PyPI
starlettepermissive · top 100 on PyPI
opentelemetry-instrumentation-flaskpermissive · top 1,000 on PyPI
pytest-djangopermissive · top 1,000 on PyPI