Serve assets directory from server?

is there any way to specify assets folder path to server locally?

You can use the assets_folder keyword: app = dash.Dash(__name__, assets_folder='files/assets').

1 Like

can you give a example at a glance?
Example, my directory tree as below:


  • App
    . component 1

    . subcomponent1

    . component2

  • lib

  • is main file, I run project by python In, I init a dash object by dash_app = Dash(__name__, server = app, assets_folder = 'assets'). But it seems not to be run, what should I do? Thank you

Network snipped as

Output of terminal is bellow

My problem is that, if I locate flask_app modul and dash_app modul in the same directory, it works. But when I put them in different folder, it doesnot work

Have you tried setting the assets_folder to the relative path from you main file?
If you run, what happens if you set the path to App/component1/subcomponent1/assets (based on the tree you mentionned)

I tried, but it notice that the local version is not found. Then, I add manually by using init
app = Dash(__name__, external_stylesheets=external_stylesheets, external_scripts=external_scripts)
It got those css and js files I pass to external_stylesheets and external_scripts.
But I didnot work.
The network and console as bellow figure:

The console:

I dont know why because if I create an same directory with the dashapp, it work. But when I used in my project, it didnot work

1 Like