Skip to main content
Flask logo

Flask

v1.6.8 Apache-2.0

z4j-flask ยท Upstream project

Flask extension pattern. One line to install.

Standard Flask extension shape (Z4J(app)). Discovers Celery or Dramatiq tasks from your extensions/ layout. Reads config from app.config. No monkey-patching, no magic.

Latest
v1.6.8
Released
2026-06-08
License
Apache-2.0

Install

bash
pip install z4j-flask
Pick an engine

Flask + any task engine

Every extra pulls the engine adapter AND its companion scheduler in one shot, so a fresh install never needs a second command.

Engine Install command Bundled scheduler
Celery recommended pip install z4j-flask[celery] celery-beat
RQ pip install z4j-flask[rq] rq-scheduler
Dramatiq pip install z4j-flask[dramatiq] APScheduler
Huey pip install z4j-flask[huey] huey-periodic
arq pip install z4j-flask[arq] arq-cron
TaskIQ pip install z4j-flask[taskiq] taskiq-scheduler
Every engine (CI / kitchen sink) pip install z4j-flask[all] all of the above

pip install z4j-flask with no extra installs only the framework adapter. Pick an engine extra for the normal case.

Wire it in

python
from flask import Flask
from z4j_flask import Z4J

app = Flask(__name__)
app.config.from_prefixed_env("Z4J_")
z4j = Z4J(app)
Verify

Confirm the agent reaches the brain

Run the doctor as the same user the service runs under. It probes brain DNS / TCP / TLS / WebSocket upgrade, the on-disk buffer path, and reports auto-detected engines - exits 0 on all-green, 1 on any failure.

bash
python -m z4j_flask doctor

Catches the gunicorn-under-www-data silent startup failure (the agent now auto-relocates the buffer to $TMPDIR/z4j-{uid} when $HOME is unwritable), NAT / firewall / cert mismatches, and wrong-token / wrong-project_id problems with a specific failure reason. Add --no-websocket to skip the WS round-trip, --json for scripts. Reference.

What you get

Flask-specific features

Flask extension pattern
Works with Flask-Celery / Flask-Dramatiq
config.from_prefixed_env support
Blueprint-friendly
Gunicorn-safe initialization
Engine pairings

Flask works with every z4j engine

The framework adapter handles lifecycle and config. Any engine adapter slots in alongside.

Other frameworks

See also

Get started with z4j + Flask