1

I am interested in using Dash to make some web applications for displaying data. I want to run this entirely locally without the references to unpkg.com/[...]. I realize that there is a relative package path (pointing to local files) and an external package path (pointing to external locations), but I don't understand how I can switch from external to relative.

Where is this documented and/or does anyone have a solution for running Dash without the references to these packages?

Thanks.

2 Answers 2

2

From the dash docs:

Rendering dash apps offline

The JavaScript and CSS bundles that are included in Dash component libraries are hosted on the web (on the unpkg CDN) and in the Python packages that you install. By default, dash serves the JavaScript and CSS resources from the online CDNs. This is usually much faster than loading the resources from the file system. However, if you are working in an offline or firewalled environment or if the CDN is unavailable, then your dash app itself can serve these files. These files are stored as part of the component's site-packages folder. Here's how to enable this option:

from dash import Dash

app = Dash()

app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
Sign up to request clarification or add additional context in comments.

Comments

0

This is the default behaviour as of Dash 1.0.0 onward. For the other way around, use serve_locally=False when initiating the Dash application. i.e. app = Dash(..., serve_locally=False)

For reference, documentation is here: https://dash.plotly.com/external-resources

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.