Installation#

Requirements#

Python 3.8 to 3.12 supported.

Django 3.2 to 5.0 supported.

Step (5) below assumes that you are using django-csp.

Installation#

  1. Install with pip:

    python -m pip install django-reporting-endpoints
    
  2. Add django-reporting-endpoints to your INSTALLED_APPS:

    INSTALLED_APPS = [
        ...,
        "reporting_endpoints",
        ...,
    ]
    
  3. Configure your REPORTING_ENDPOINTS:

    REPORTING_ENDPOINTS = {
        "csp-violations": "/_/csp-reports/",
    }
    
  4. Add the middleware:

    MIDDLEWARE = [
        ...,
        "reporting_endpoints.middleware.ReportingEndpointsMiddleware",
        ...,
    ]
    
  1. Add the view to your urlconfig:

    urlpatterns = [
        ...,
        path(
            "_/csp-reports/", reporting_endpoint, kwargs={"endpoint_name": "csp-endpoint"}
        ),
    ]
    
  2. Configure your report-to directives for the packages you use. For example, if you use django-csp:

    CSP_REPORT_TO = "csp-violations"