Configuration Reference

Django Hurricane provides a flexible configuration system supporting Django Settings, Command-Line Arguments, and Environment Variables.


Configuration Conventions & Precedence

Full Symmetry Between Prefixed and Unprefixed Names

Hurricane provides 100% naming symmetry across all configuration formats:

  • Django settings.py: Every setting can be declared using the concise setting name (e.g. PORT = 8000, RATE_LIMIT = "10/s", FAST_404 = "auto") or the explicit namespaced equivalent (e.g. HURRICANE_PORT = 8000, HURRICANE_RATE_LIMIT = "10/s"). Both forms are evaluated identically.
  • Environment Variables: Can be specified with HURRICANE_ (recommended in container environments to avoid name collisions) or without (e.g. HURRICANE_PORT=8000 or PORT=8000).
  • Rate Limiting: Rate limiting can be configured directly with individual scalar settings (RATE_LIMIT, RATE_LIMIT_BURST, RATE_LIMIT_PROXY_HEADER, RATE_LIMIT_ENABLED) without requiring a nested dictionary. (The dictionary syntax HURRICANE_RATE_LIMIT = {"ENABLED": True, "RATE": 10.0, ...} continues to be supported).
  • CLI Arguments: Standard command-line flags passed to python manage.py serve (e.g. --port=8000).

Precedence Order

When the same parameter is specified in multiple places, Hurricane resolves the final value in this order:

  1. CLI Arguments (highest priority)
  2. Django settings.py (recommended for application configuration)
  3. Environment Variables (ideal for container runtime overrides)

Server Core Settings

PORT

CLI: --portEnv: HURRICANE_PORTDefault: 8000Also accepts: HURRICANE_PORT

The TCP port on which the HTTP application server listens for incoming Django traffic.

PROBE_PORT

CLI: --probe-portEnv: HURRICANE_PROBE_PORTDefault: port + 1 (8001)Also accepts: HURRICANE_PROBE_PORT

Dedicated port for Kubernetes health probes (/alive, /ready, /startup) and Prometheus metrics (/metrics). Keeping probe traffic isolated prevents health checks from being starved by heavy application traffic. When omitted, defaults to port + 1.

MODE

CLI: --mode (or --interface)Env: HURRICANE_MODEDefault: autoAlso accepts: HURRICANE_MODE, INTERFACE, HURRICANE_INTERFACE

Application execution mode. Supported values: auto, wsgi, asgi. In auto mode, Hurricane automatically detects whether ASGI_APPLICATION is set in your Django settings and runs ASGI; otherwise, it runs standard WSGI.

WORKERS

CLI: --workersEnv: HURRICANE_WORKERSDefault: CPUs + 4Also accepts: HURRICANE_WORKERS

Number of native OS worker threads used to handle request concurrency. When omitted, defaults to the number of available CPU cores plus 4.

RUNTIME_THREADS

CLI: --runtime-threadsEnv: HURRICANE_RUNTIME_THREADSDefault: CPUs (ASGI) / 1 (WSGI)Also accepts: HURRICANE_RUNTIME_THREADS

Number of Rust/Tokio async runtime worker threads in Granian. In ASGI mode, defaults to the number of available CPU cores (capped at 16) to allow multi-core event loop task scheduling. In WSGI mode, defaults to 1.

AUTORELOAD

CLI: --autoreloadEnv: HURRICANE_AUTORELOADDefault: FalseAlso accepts: HURRICANE_AUTORELOAD

Reloads code automatically when Python source file changes are detected. Intended for local development.

DEBUG

CLI: --debugEnv: HURRICANE_DEBUGDefault: FalseAlso accepts: HURRICANE_DEBUG

Enables verbose debug flag. When enabled, health probe errors return detailed error strings rather than generic status codes.


Static & Media File Serving

STATIC

CLI: --staticEnv: HURRICANE_STATICDefault: FalseAlso accepts: HURRICANE_STATIC

Enables serving collected static files directly through the gateway using STATIC_URL and STATIC_ROOT from Django settings.

MEDIA

CLI: --mediaEnv: HURRICANE_MEDIADefault: FalseAlso accepts: HURRICANE_MEDIA

Enables serving media files directly through the gateway using MEDIA_URL and MEDIA_ROOT from Django settings.

STATIC_WATCH

CLI: --static-watchEnv: HURRICANE_STATIC_WATCHDefault: NoneAlso accepts: HURRICANE_STATIC_WATCH

List of directories to watch for changes during development; automatically triggers collectstatic when changes occur.


Fast-404 Security Settings

FAST_404

CLI: --fast-404 / --no-fast-404Env: HURRICANE_FAST_404Default: autoAlso accepts: HURRICANE_FAST_404

Fast-404 protection strategy. Supported values: auto, signature, prefix, or off. In auto mode, prefix matching is used when valid URL prefixes can be extracted, otherwise signature matching. Setting to off or passing --no-fast-404 disables the shield.

FAST_404_PATTERNS

Default: 30+ built-in signaturesAlso accepts: HURRICANE_FAST_404_PATTERNS

List of custom regex patterns or file endings to drop at the gateway before reaching Django middleware or database connections.

FAST_404_EXTRA_PREFIXES

Default: NoneAlso accepts: HURRICANE_FAST_404_EXTRA_PREFIXES

List of additional URL path prefixes to drop immediately at the gateway.


Rate Limiting Settings

RATE_LIMIT

CLI: --rate-limit / --no-rate-limitEnv: HURRICANE_RATE_LIMITDefault: 10/sAlso accepts: HURRICANE_RATE_LIMIT

Sustained request rate allowed per second per client IP address (e.g. 10/s, 20.0, or off / False to disable). Can also be configured via dictionary if preferred.

RATE_LIMIT_BURST

CLI: --rate-limit-burstEnv: HURRICANE_RATE_LIMIT_BURSTDefault: 30Also accepts: HURRICANE_RATE_LIMIT_BURST

Burst token capacity allowed above the sustained rate limit for short traffic bursts.

RATE_LIMIT_PROXY_HEADER

CLI: --rate-limit-proxy-headerEnv: HURRICANE_RATE_LIMIT_PROXY_HEADERDefault: X-Forwarded-ForAlso accepts: HURRICANE_RATE_LIMIT_PROXY_HEADER

Proxy header used to extract the client IP address behind load balancers or Kubernetes Ingress controllers.

RATE_LIMIT_ENABLED

Default: TrueAlso accepts: HURRICANE_RATE_LIMIT_ENABLED

Explicit boolean switch (True or False) to toggle the rate limiter without altering rate or burst thresholds.


Kubernetes Health Probes & Metrics

STARTUP_PROBE

CLI: --startup-probeEnv: HURRICANE_STARTUP_PROBEDefault: /startupAlso accepts: HURRICANE_STARTUP_PROBE

URL route on the probe port for Kubernetes startup checks. Returns HTTP 200 once initialization and pre-flight commands have completed.

LIVENESS_PROBE

CLI: --liveness-probeEnv: HURRICANE_LIVENESS_PROBEDefault: /aliveAlso accepts: HURRICANE_LIVENESS_PROBE

URL route on the probe port for Kubernetes liveness checks. Verifies that the server process and thread pool are actively responding.

READINESS_PROBE

CLI: --readiness-probeEnv: HURRICANE_READINESS_PROBEDefault: /readyAlso accepts: HURRICANE_READINESS_PROBE

URL route on the probe port for Kubernetes readiness checks. Verifies database connectivity and pending request backlog.

REQ_QUEUE_LEN

CLI: --req-queue-lenEnv: HURRICANE_REQ_QUEUE_LENDefault: 10Also accepts: HURRICANE_REQ_QUEUE_LEN

Maximum length of the pending request queue before /ready returns HTTP 400 to temporarily shed ingress traffic.

NO_PROBE

CLI: --no-probeEnv: HURRICANE_NO_PROBEDefault: FalseAlso accepts: HURRICANE_NO_PROBE

Disables the health probe server completely.

METRICS

CLI: --metricsEnv: HURRICANE_METRICSDefault: /metricsAlso accepts: HURRICANE_METRICS

URL route on the probe port for Prometheus metrics exposition.

NO_METRICS

CLI: --no-metricsEnv: HURRICANE_NO_METRICSDefault: FalseAlso accepts: HURRICANE_NO_METRICS

Disables Prometheus metric collection and exposition.

LOG_PROBES

Default: FalseAlso accepts: HURRICANE_LOG_PROBES

When False (default), HTTP access logging for probe requests (/alive, /ready, /startup, /metrics) is suppressed to prevent log noise. Set to True in settings.py to log all probe requests.


Process Lifecycle & Resource Limits

MAX_LIFETIME

CLI: --max-lifetimeEnv: HURRICANE_MAX_LIFETIMEDefault: NoneAlso accepts: HURRICANE_MAX_LIFETIME

Maximum number of requests after which a worker process is restarted. When None, processes run indefinitely.

MAX_MEMORY

CLI: --max-memoryEnv: HURRICANE_MAX_MEMORYDefault: NoneAlso accepts: HURRICANE_MAX_MEMORY

Maximum memory (Resident Set Size) in megabytes before process reload. When None, no memory reload limit is enforced.

MAX_BODY_SIZE

CLI: --max-body-sizeEnv: HURRICANE_MAX_BODY_SIZEDefault: 104857600 (100 MB)Also accepts: HURRICANE_MAX_BODY_SIZE

Maximum size of the request body in bytes.

MAX_BUFFER_SIZE

CLI: --max-buffer-sizeEnv: HURRICANE_MAX_BUFFER_SIZEDefault: 104857600 (100 MB)Also accepts: HURRICANE_MAX_BUFFER_SIZE

Maximum size of the request buffer in bytes.


Startup Commands & Migrations

COMMAND

CLI: --commandEnv: HURRICANE_COMMANDDefault: NoneAlso accepts: HURRICANE_COMMAND

Management command to run asynchronously during pod startup before the server opens traffic.

CHECK_MIGRATIONS

CLI: --check-migrationsEnv: HURRICANE_CHECK_MIGRATIONSDefault: FalseAlso accepts: HURRICANE_CHECK_MIGRATIONS

Checks if pending database migrations were applied before starting the server.

CHECK_MIGRATIONS_APPLY

CLI: --check-migrations-applyEnv: HURRICANE_CHECK_MIGRATIONS_APPLYDefault: FalseAlso accepts: HURRICANE_CHECK_MIGRATIONS_APPLY

Checks if database migrations are pending and applies them automatically prior to opening traffic.


Debugger Settings

DEBUGGER

CLI: --debuggerEnv: HURRICANE_DEBUGGERDefault: FalseAlso accepts: HURRICANE_DEBUGGER

Opens a debugger port according to the Debug Adapter Protocol (e.g. for VS Code).

DEBUGGER_PORT

CLI: --debugger-portEnv: HURRICANE_DEBUGGER_PORTDefault: 5678Also accepts: HURRICANE_DEBUGGER_PORT

The port for the debug client to attach to.

PYCHARM_HOST

CLI: --pycharm-hostEnv: HURRICANE_PYCHARM_HOSTDefault: NoneAlso accepts: HURRICANE_PYCHARM_HOST

Host of the remote PyCharm debug server.

PYCHARM_PORT

CLI: --pycharm-portEnv: HURRICANE_PYCHARM_PORTDefault: NoneAlso accepts: HURRICANE_PYCHARM_PORT

Port of the remote PyCharm debug server.


Webhooks

WEBHOOK_URL

CLI: --webhook-urlEnv: HURRICANE_WEBHOOK_URLDefault: NoneAlso accepts: HURRICANE_WEBHOOK_URL

Target URL where Hurricane sends asynchronous lifecycle notifications (startup, liveness, graceful termination).

HURRICANE_VERSION

Default: Package versionAlso accepts: VERSION

Custom version string included in webhook payloads for deployment tracking.