[docs]classCeleryFlower(BaseServerBackend):"""Backend to start a Celery Flower monitoring server."""def__init__(self,**server_config:Any)->None:""" Initialize the Celery Flower backend. Validates that the ``flower`` package is installed, since it is an optional dependency that registers the ``flower`` subcommand on the Celery app. Raises: ImproperlyConfigured: If the ``flower`` package is not installed. """try:importflower# noqa: F401exceptImportErrorase:raiseImproperlyConfigured("flower is required to use the CeleryFlower backend. ""Install it with: pip install django-prodserver[flower]")fromecelery_app_str=server_config.get("APP")self.app=import_string(celery_app_str)super().__init__(**server_config)
[docs]defstart_server(self,*args:str)->None:"""Start Celery Flower via the ``flower`` subcommand on the Celery app."""self.app.start(argv=["flower",*args])