Background callback with dash extensions and flask

I have a Dash app inside a Flask app and am using DashProxy from dash extensions. My problem is getting the background callback with Celery to work. Celery shows the following error: Received un registered task of type 'long_callback. The app is initialized like this:

from celery_app import celery_app
from dash_extensions.enrich import NoOutputTransform, DashProxy

background_callback_manager = CeleryManager(celery_app)

def init_dash(server):

    app = DashProxy(__name__, server=server, url_base_pathname='/dashboard/',

    ### Define Layout
    return app

def init_callbacks(app):

        Output('out', 'children'),
        Input('in', 'n_clicks'),
    def process(in, out):

      # Some long-running calculation

      return out

In another file i have a function to stitch the Flask and Dash apps together:

from flask import Flask

def create_app():

    app = Flask(__name__)

    from .app_dash import init_dash
    app = init_dash(app)

    return app.server

And finally in the app is run in another file with this code:

from flask_wrapper import create_app

app = create_app()

if __name__ == '__main__':'', port=8080, debug=False)

Since there are some callbacks without an output I would like to keep using DashProxy. In order to get Celery to work do I maybe have to move app.register_celery_tasks() to a different location or change my import statements? Glad if anyone could help me with this issue :slight_smile:

Hi there! Have you tried adding
from dash.long_callback import CeleryLongCallbackManager


Just tried it and unfortunately the same error appears. Is it possible that initializing Dash inside a function leads to this behavior?

I also cannot get background callbacks working when using DashProxy from dash-extensisons. In my case celery worker does not register the background callback.