Open yordanovn opened 1 year ago
I managed to resolve my issue by unwrapping the du.callback
method within my own page definition.
The change is that instead of calling app.callback
which would have used DashProxy.callback
we now call callback
which is imported from dash
. By doing this we are bypassing the issue that the blueprint
attribute doesn't yet exist for the DashProxy
instance.
I will keep the issue as Open, since there still might be a fix or a documentation update within the dash-uploader
project to better accommodate integration with dash-extensions
.
Here is an example:
app.py:
from dash_extensions.enrich import DashProxy, ServersideOutputTransform
app = DashProxy(__name__, use_pages=True, transforms=[ServersideOutputTransform()])
file_upload.py:
import dash
from dash import html, Output
import dash_uploader as du
from dash_uploader.callbacks import create_dash_callback
import dash_uploader.settings as settings
app = dash.get_app()
du.configure_upload(app=app, folder='./uploads')
dash.register_page(__name__, path='/')
layout = html.Div(children=[
du_file_upload := du.Upload(id='du-file-upload'),
du_uploads := html.Div(id='du-uploads')
] )
def update_du_uploads(filenames):
return html.Ul([html.Li(filenames)])
dash_callback = create_dash_callback(
update_du_uploads,
settings,
)
callback(
Output('du-uploads', 'children'),
Input('du-file-upload', 'isCompleted'),
State('du-file-upload', 'fileNames'),
State('du-file-upload', 'upload_id')
)(dash_callback)
Hi, I'm building a multi-page Dash application. It utilises functionality from the
dash-extensions
package, however I experience issues when I want to use adash-uploader
callback function.The error I get is:
AttributeError: 'DashProxy' object has no attribute 'blueprint'.
I managed to figure out that it occurs, because the DashProxy's
callback
method is using theblueprint
attribute, however thedu.callback
is trying to call it before the attribute is assigned to the instance. I don't know how to work around this issue.Note: I'm not sure if
dash-uploader
is supposed to work withdash-extensions
and this is an issue or rather a feature request.Here's how the code is structured:
app.py:
file_upload.py:
Here is the full Traceback: