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
--port
Env
HURRICANE_PORT
Default
8000

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

PROBE_PORT

CLI
--probe-port
Env
HURRICANE_PROBE_PORT
Default
port + 1 (8001)

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.

WORKERS

CLI
--workers
Env
HURRICANE_WORKERS
Default
CPUs + 4

Maximum concurrency ceiling and worker thread pool size used to execute Django code. When omitted, defaults to the number of available CPU cores plus 4.

RUNTIME_THREADS

CLI
--runtime-threads
Env
HURRICANE_RUNTIME_THREADS
Default
CPUs (capped at 4)

Number of Rust/Tokio async runtime worker threads in Hurricane's underlying Granian engine. Defaults to detected container CPUs (capped at 4) to prevent CFS quota throttling in small pods.

RUNTIME_MODE

CLI
--runtime-mode
Env
HURRICANE_RUNTIME_MODE
Default
auto

Async runtime engine architecture in Granian: 'auto', 'st' (single-threaded runtime), or 'mt' (multi-threaded work-stealing runtime). In 'auto', defaults to 'st' if runtime_threads == 1 (optimal for Kubernetes pods with ≤ 1 vCPU to eliminate cross-thread synchronization overhead and avoid Linux CFS CPU quota throttling), and 'mt' when multiple runtime threads are allocated.

AUTORELOAD

CLI
--autoreload
Env
HURRICANE_AUTORELOAD
Default
False

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

DEBUG

CLI
--debug
Env
HURRICANE_DEBUG
Default
False

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


Static & Media File Serving

STATIC

CLI
--static
Env
HURRICANE_STATIC
Default
False

Enables high-performance static file serving using STATIC_URL and STATIC_ROOT. When STATIC_ROOT is populated (e.g. after collectstatic), files are served natively in Rust via Granian at Nginx-grade speed (<20µs). In development or when STATIC_ROOT is empty, Hurricane automatically falls back to dynamic discovery across STATICFILES_DIRS and all installed apps without requiring collectstatic. For architecture details and workflows, see the Static & Media Files Guide.

COLLECTSTATIC

CLI
--collectstatic
Env
HURRICANE_COLLECTSTATIC
Default
False

Automatically runs Django's collectstatic command during server pre-flight startup before the network socket binds. Populates STATIC_ROOT so Granian can immediately mount assets into its native Rust streaming engine.

MEDIA

CLI
--media
Env
HURRICANE_MEDIA
Default
False

Enables serving user-uploaded media files directly from MEDIA_ROOT under MEDIA_URL. Mounted natively in Granian when the directory exists on disk.

STATIC_WATCH

CLI
--static-watch
Env
HURRICANE_STATIC_WATCH
Default
None

List of extra directories or file paths to watch for changes during development. When combined with --autoreload, modifying any watched asset triggers Granian to reload and synchronize static bundles.

STATIC_CACHE_EXPIRES

Env
HURRICANE_STATIC_CACHE_EXPIRES
Default
86400
Also
STATIC_CACHE_EXPIRES

HTTP Cache-Control: max-age header duration in seconds applied to static assets served through Granian's native Rust mount. Defaults to 86400 (24 hours).


Fast-404 Security Settings

FAST_404

CLI
--fast-404 / --no-fast-404
Env
HURRICANE_FAST_404
Default
auto

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, automatically falling back to signature matching when a root catch-all or CMS router is detected. For details on how signatures and on-demand caching operate, see the Signature Mode & Anti-Django Patterns Guide. Setting to off or passing --no-fast-404 disables the shield.

FAST_404_PATTERNS

Default
Built-in Anti-Django Signatures
Also
HURRICANE_FAST_404_PATTERNS

List of custom regex patterns or file endings to drop at the gateway before reaching Django middleware or database connections. Custom patterns extend the comprehensive Built-in Signature Pattern Categories covering PHP/WordPress, Laravel, Java/Spring Actuators, ASP.NET, Node.js, and database dump probes.

FAST_404_EXTRA_PREFIXES

Default
None
Also
HURRICANE_FAST_404_EXTRA_PREFIXES

List of additional URL path prefixes to drop immediately at the gateway when running in prefix mode.


Rate Limiting Settings

RATE_LIMIT

CLI
--rate-limit / --no-rate-limit
Env
HURRICANE_RATE_LIMIT
Default
10/s

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-burst
Env
HURRICANE_RATE_LIMIT_BURST
Default
30

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

RATE_LIMIT_PROXY_HEADER

CLI
--rate-limit-proxy-header
Env
HURRICANE_RATE_LIMIT_PROXY_HEADER
Default
X-Forwarded-For

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

RATE_LIMIT_ENABLED

Default
True
Also
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-probe
Env
HURRICANE_STARTUP_PROBE
Default
/startup

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-probe
Env
HURRICANE_LIVENESS_PROBE
Default
/alive

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-probe
Env
HURRICANE_READINESS_PROBE
Default
/ready

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

REQ_QUEUE_LEN

CLI
--req-queue-len
Env
HURRICANE_REQ_QUEUE_LEN
Default
10

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

NO_PROBE

CLI
--no-probe
Env
HURRICANE_NO_PROBE
Default
False

Disables the health probe server completely.

METRICS

CLI
--metrics
Env
HURRICANE_METRICS
Default
/metrics

URL route on the probe port for Prometheus metrics exposition.

NO_METRICS

CLI
--no-metrics
Env
HURRICANE_NO_METRICS
Default
False

Disables Prometheus metric collection and exposition.

LOG_PROBES

Default
False
Also
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-lifetime
Env
HURRICANE_MAX_LIFETIME
Default
None

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

MAX_MEMORY

CLI
--max-memory
Env
HURRICANE_MAX_MEMORY
Default
None

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

MAX_BODY_SIZE

CLI
--max-body-size
Env
HURRICANE_MAX_BODY_SIZE
Default
104857600 (100 MB)

Maximum size of the request body in bytes.

MAX_BUFFER_SIZE

CLI
--max-buffer-size
Env
HURRICANE_MAX_BUFFER_SIZE
Default
104857600 (100 MB)

Maximum size of the request buffer in bytes.


Startup Commands & Migrations

COMMAND

CLI
--command
Env
HURRICANE_COMMAND
Default
None

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

CHECK_MIGRATIONS

CLI
--check-migrations
Env
HURRICANE_CHECK_MIGRATIONS
Default
False

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

CHECK_MIGRATIONS_APPLY

CLI
--check-migrations-apply
Env
HURRICANE_CHECK_MIGRATIONS_APPLY
Default
False

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


Debugger Settings

DEBUGGER

CLI
--debugger
Env
HURRICANE_DEBUGGER
Default
False

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

DEBUGGER_PORT

CLI
--debugger-port
Env
HURRICANE_DEBUGGER_PORT
Default
5678

The port for the debug client to attach to.

PYCHARM_HOST

CLI
--pycharm-host
Env
HURRICANE_PYCHARM_HOST
Default
None

Host of the remote PyCharm debug server.

PYCHARM_PORT

CLI
--pycharm-port
Env
HURRICANE_PYCHARM_PORT
Default
None

Port of the remote PyCharm debug server.


Webhooks

WEBHOOK_URL

CLI
--webhook-url
Env
HURRICANE_WEBHOOK_URL
Default
None

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

HURRICANE_VERSION

Default
Package version
Also
VERSION

Custom version string included in webhook payloads for deployment tracking.