Skip to content

Urls and Views

Urls

rn_forge.django.urls

Simple Django URLconf for reusable helper views.

Views

rn_forge.django.views

Standalone Django views that can be included directly from URLconf.

No health-check library is adopted: django-health-check 4.6.1 (checked 2026-09-23) answers a failing or warning check with a hard-coded 500, has no required-versus-optional distinction and no timeout.

debug_request(request)

Return a structured snapshot of request for logging or error reports.

Sensitive authorization, cookie, and API-key metadata is redacted.

debug_request_view(request, **kwargs)

Return the structured request snapshot produced by :func:debug_request.

health_urlpatterns(*, checks, required=(), timeout=2.0, liveness_path=LIVENESS_PATH, readiness_path=READINESS_PATH, legacy_liveness_path=LEGACY_LIVENESS_PATH)

Return liveness and readiness URL patterns, with no trailing slash.

A probe on every host fails on a redirect, so these paths are served exactly as configured — a trailing-slash APPEND_SLASH 301 would mark the instance unhealthy.

Parameters:

Name Type Description Default
checks Mapping[str, Check]

Name → synchronous readiness check.

required
required Collection[str]

Names whose failure makes the service unavailable (503).

()
timeout float | None

Seconds each readiness check may run before it is reported as fail. None waits indefinitely.

2.0
liveness_path str

The liveness path.

LIVENESS_PATH
readiness_path str

The readiness path.

READINESS_PATH
legacy_liveness_path str | None

An alias of liveness_path. None serves no alias.

LEGACY_LIVENESS_PATH

index_view(request)

Render a template-free HTML diagnostics page for the request.

liveness_view(request)

Return the liveness response, :func:rn_forge.web.liveness_body with 200.

readiness_view(checks, *, required=())

Build a readiness view that reports one entry per dependency check.

Returns 503 when a required check fails and 200 otherwise. Async checks are rejected by :func:rn_forge.web.run_checks_sync.

Parameters:

Name Type Description Default
checks Mapping[str, Check]

Name → synchronous check.

required
required Collection[str]

Names whose failure makes the service unavailable.

()

Utils

rn_forge.django.utils

Configuration guards for Django.

require_environment(*names)

Return the named environment variables, raising if any is unset or blank.

Raises:

Type Description
ImproperlyConfigured

One or more variables are missing; the message names all of them.

require_settings(*names)

Raise ImproperlyConfigured if any named Django setting is unset or blank.

All missing names are reported together. Empty values follow :meth:rn_forge.commons.lang.utils.AppUtils.is_empty.

Raises:

Type Description
ImproperlyConfigured

One or more settings are missing.