fohrloop / dash-uploader

The alternative upload component for python Dash applications.
MIT License
141 stars 29 forks source link

multi page issue #106

Closed omarirfa closed 1 year ago

omarirfa commented 1 year ago

Hi,

I recently started using dash-uploader and was wondering if there is multi page support since I could not find an example. All the current examples require the app to be initialized using the command below for the du.configure_upload and has to be located in the same file where dash-uploader is used.

Command to initialize du.configure_upload: app = Dash(__name__, suppress_callback_exceptions=True, external_stylesheets=[dbc.themes.BOOTSTRAP])

Heres my code below:

# app = Dash(__name__, suppress_callback_exceptions=True, external_stylesheets=[dbc.themes.BOOTSTRAP])
dash.register_page(__name__, styles=dbc.themes.BOOTSTRAP)
UPLOAD_FOLDER = r"D:/AzureDevOps/saltr/csv_feature/temporary_folder"
du.configure_upload(app, UPLOAD_FOLDER)

I was wondering if there is another way to use du.configure_upload with dash.register_page instead of using dash.Dash since we have this registered somewhere else in the code?

zh1lu0 commented 1 year ago

May be you can use dash.get_app() in page to get app instance.

ref: https://dash.plotly.com/urls#circular-imports In cases where you need access to the app in one of your page layouts, you can access it with dash.get_app.

omarirfa commented 1 year ago

Thanks that solved the issue!