{"id":23623,"library":"dockerflow","title":"dockerflow","description":"Python tools and helpers for implementing Mozilla's Dockerflow standards, providing health check endpoints (__version__, __heartbeat__, __lbheartbeat__), structured logging (MozLog), and framework integrations for Django, Flask, FastAPI, Sanic, and others. Current version: 2026.3.4. Active development with monthly/quarterly releases.","status":"active","version":"2026.3.4","language":"python","source_language":"en","source_url":"https://github.com/mozilla-services/python-dockerflow","tags":["dockerflow","moziila","health-check","monitoring","django","flask","fastapi","logging","mozlog"],"install":[{"cmd":"pip install dockerflow","lang":"bash","label":"Core install"},{"cmd":"pip install dockerflow[django]","lang":"bash","label":"With Django support"},{"cmd":"pip install dockerflow[flask]","lang":"bash","label":"With Flask support"},{"cmd":"pip install dockerflow[fastapi]","lang":"bash","label":"With FastAPI support"}],"dependencies":[],"imports":[{"note":"Import the module, not individual check functions; use register_check instead.","wrong":"from dockerflow.checks import *","symbol":"checks","correct":"from dockerflow import checks"},{"note":"The Django integration uses a specific middleware and view; no class named DjangoDockerflow.","wrong":"from dockerflow import DjangoDockerflow","symbol":"Django","correct":"from dockerflow.django import DockerflowMiddleware, dockerflow_view"},{"note":"FastAPI integration provides a router object, not a class.","wrong":"from dockerflow import FastAPIRouter","symbol":"FastAPI","correct":"from dockerflow.fastapi import router"},{"note":"Used as an extension: Dockerflow(app). No common wrong import known.","symbol":"Flask","correct":"from dockerflow.flask import Dockerflow"}],"quickstart":{"code":"from dockerflow import checks\nfrom dockerflow.flask import Dockerflow\nfrom flask import Flask\n\napp = Flask(__name__)\ndockerflow = Dockerflow(app)\n\n@checks.register('storage')\ndef storage_check(config):\n    if not some_storage_available():\n        return [checks.Error('storage unavailable')]\n    return []\n\n@app.route('/')\ndef index():\n    return 'OK'\n\nif __name__ == '__main__':\n    app.run()","lang":"python","description":"Minimal Flask app with dockerflow endpoints (__version__, __heartbeat__, __lbheartbeat__) and a custom check."},"warnings":[{"fix":"Treat warning results as 200 OK; only error results cause 5xx. See https://github.com/mozilla-services/python-dockerflow/issues/110","message":"Heartbeat returns 200 even when checks issue warnings (only 5xx for errors). Reading docstrings incorrectly can lead to expecting 5xx on warnings.","severity":"gotcha","affected_versions":"all"},{"fix":"Add middleware and define the view URL pattern explicitly: path('__version__', dockerflow_view, name='dockerflow-version')","message":"In Django, you must add 'dockerflow.django.middleware.DockerflowMiddleware' to MIDDLEWARE and mount the view yourself. The old `urlpatterns += [path(...)]` pattern is outdated in some docs.","severity":"gotcha","affected_versions":">=2024.1.0"},{"fix":"Remove `default_app_config` from any Django app config; it has no effect and may cause deprecation warnings.","message":"The `default_app_config` in Django apps is removed in django>3.2 and not needed for dockerflow.","severity":"deprecated","affected_versions":">=2022.7.0"},{"fix":"Include router as `app.include_router(router)` without prefix (defaults to '').","message":"When using FastAPI, the dockerflow router must be included with prefix='', or endpoints will be duplicated. Incorrect prefix leads to 404 on heartbeat endpoints.","severity":"gotcha","affected_versions":">=2024.2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from dockerflow.django import DockerflowMiddleware, dockerflow_view` instead.","cause":"Old documentation or code snippets refer to a non-existent class.","error":"ImportError: cannot import name 'DjangoDockerflow' from 'dockerflow'"},{"fix":"Explicitly import `from dockerflow import checks`.","cause":"Importing the top-level package without importing the submodule.","error":"AttributeError: module 'dockerflow' has no attribute 'checks'"},{"fix":"Add URL pattern: `path('__version__', dockerflow_view, name='dockerflow-version')` and ensure middleware is added.","cause":"Django project missing the dockerflow view URL configuration.","error":"RuntimeError: Unable to find a DockerflowView: No view named 'dockerflow'"},{"fix":"Include router with `prefix=''` or no prefix: `app.include_router(router)`.","cause":"Using FastAPI router with a prefix like '/dockerflow' which conflicts with the pre-defined endpoint paths.","error":"fastapi.exceptions.FastAPIError: Invalid args for response status code"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}