Add a local external css file to Dash Webapp

Options
tsalim786
tsalim786 Registered Posts: 3

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

Best Answer

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,737 Neuron
    Answer ✓
    Options

    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?

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,737 Neuron
    Options

    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.

  • tsalim786
    tsalim786 Registered Posts: 3
    edited July 17
    Options

    @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

  • tsalim786
    tsalim786 Registered Posts: 3
    Options

    I understand and your solution works. Thank you!

Setup Info
    Tags
      Help me…