skillfed

django-cors-headers

django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS).

django-cors-headers Permissive license MIT Active 5,592 v4.9.0 released

Install

django-cors-headers on PyPI

pip

pip install django-cors-headers

uv

uv add django-cors-headers

poetry

poetry add django-cors-headers

Package 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTyping :: Typed

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

Read as markdown · JSON record · Source repository

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
django cors headers middlewarecross-origin resource sharing djangocors middleware for djangodjango api cross-origin requestsenable cors in djangodjango rest api corscross-origin django responses

Similar packages