Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

How can we replace the CDN js file with other online providers or localize it?

I live in China and the gov has blocked some foreign online CDN providers like https://cdn.rawgit.com. So it takes forever and fails to load in the end. I am wondering if it is possible to replace cdn.rawgit.com with other providers or localize the js file.

1 Like

The only CDN that the Dash packages use is unpkg e.g. https://unpkg.com/dash-core-components@0.12.5/dash_core_components/bundle.js. To serve this files locally, see the last section in https://plot.ly/dash/external-resources

1 Like

oh, my bad. Do you mind telling me what is this js using for?
https://cdn.rawgit.com/chriddyp/ca0d8f02a1659981a0ea7f013a378bbd/raw/e79f3f789517deec58f41251f7dbb6bee72c44ab/plotly_ga.js

I get it from:

if 'DYNO' in os.environ:
    app.scripts.config.serve_locally = False
    app.scripts.append_script({
        'external_url': 'https://cdn.rawgit.com/chriddyp/ca0d8f02a1659981a0ea7f013a378bbd/raw/e79f3f789517deec58f41251f7dbb6bee72c44ab/plotly_ga.js'
    })

@BingWong - That is a google analytics script that is used for our own analytics on our demo apps. You should not include this script in your app.

Everything that you need to be aware of should be in the official dash guidelines at https://plot.ly/dash

1 Like