Here’s a slightly easier way… if you have a CSS file in assets/main.css
then you can use the static_folder
argument of dash.Dash()
to serve up that folder, and then use html.Link
to reference it, with an href
that starts with /
to make it relative to the root of your server:
app = dash.Dash(__name__, static_folder='assets')
app.scripts.config.serve_locally=True
app.css.config.serve_locally=True
app.layout = html.Div([
html.Link(href='/assets/main.css', rel='stylesheet'),
.....
])