Add a local external css file to Dash Webapp

Solved!
tsalim786
Level 1
Add a local external css file to Dash Webapp

Is it possible to source a css file into a Python Dash Webapp from another location other than the local/static/globalsharedcode directory? Having the css file there impacts other webapps as well. For instance, would it be possible to add my css files in a folder within my dataflow and call those css files into the webapp? 

Not sure how this is done and not finding the exact answer on any online forums either. Any help would be appreciated.

Thank you

0 Kudos
1 Solution
Turribeach

I donโ€™t understand what problem you are facing. As I said you can create folders inside the Global Shared Code so you can separate CCS. Can you clarify what is the issue that you are facing?

View solution in original post

0 Kudos
4 Replies
Turribeach

No, it's not allowed for security purposes. You don't really want to have project folders exposed to web servers. But I don't see what the issue is. Just create folders for each project if you want project separation.

0 Kudos
tsalim786
Level 1
Author

@Turribeach Thanks for your reply. I've shared my code below on how I am calling in the css file which is stored under Global_shared_code > Static_web_resources. What part of the code, if any, would change if this particular project was placed in another folder on the home page of Dataiku? 

 

 

#External CSS Stylesheets
external_stylesheets_style = [
    'https://codepen.io/chriddyp/pen/bWLwgP.css',
    {
        'href':'/local/static/style.css',
        'rel':'stylesheet',
    }

]

app.config.external_stylesheets = external_stylesheets_style

 

 

0 Kudos
Turribeach

I donโ€™t understand what problem you are facing. As I said you can create folders inside the Global Shared Code so you can separate CCS. Can you clarify what is the issue that you are facing?

0 Kudos
tsalim786
Level 1
Author

I understand and your solution works. Thank you!

0 Kudos