GibbsConsulting / django-plotly-dash

Expose plotly dash apps as django tags
MIT License
560 stars 125 forks source link

Using dash-tradingview dash_tvlwc breaks the app in Django #477

Closed notgonnamakeit closed 1 year ago

notgonnamakeit commented 1 year ago

Hi, I have a functioning Dash app using dash_tvwlc that works fine if I run it on its own. When I try to display it in Django, I get an error that its JS file can't be downloaded from unpkg.com:

image

When I run the app on its own outside of Django, it serves the JS locally. Any idea how I can make that work?

delsim commented 1 year ago

@notgonnamakeit what configuration parameters do you have - in particular the STATICFILES_FINDERS and PLOTLY_COMPONENTS ones?

notgonnamakeit commented 1 year ago

@delsim I didn't have any set, and didn't know I had to. It works now that I've configured it like this:

STATICFILES_FINDERS =[
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'django_plotly_dash.finders.DashAssetFinder',
    'django_plotly_dash.finders.DashComponentFinder',
    'django_plotly_dash.finders.DashAppDirectoryFinder',
 ]

PLOTLY_DASH = {
    "serve_locally": True,
}

PLOTLY_COMPONENTS = [
    'dpd_components',
    'dpd_static_support',
    'dash_bootstrap_components',
    'dash_mantine_components',
    'dash_tvlwc',
]

Thanks for pointing me in the right direction.