Black Lives Matter. Please consider donating to Black Girls Code today.

Adding css with Apache

Hi,

To add a custom css style sheet I used to do:
dcc._css_dist[0]['relative_package_path'].append('xxx.css')

But with the new dash-core-components update I should add the xxx.css into the assets directory.

In the testing environment, when I do: python app.py it all works correctly and the xxx.css is found and loaded correctly.

However, when I deploy to my Apache server the assets directory doesn’t seem to be found? I also note that “absolute” paths are not presently allowed for.

Is there anything else I can do?

Thanks,
Peter

p.s. the assets directory is has read/write access to all and is listed as order allow, deny and allow from all in the Apache conf.

I had a look at the Apache access_log and found the following:

"GET /APP/ HTTP/1.1 …
"GET /assets/xxx.css …
"GET /APP/_dash-layout …
"GET /APP/_dash-dependencies …
"POST /APP/_dash-update-component …
"POST /APP/_dash-update-component …
"POST /APP/_dash-update-component …

So it looks like dash has found the assets, but for some reason it’s not using them??

I am sharing the server with other webpages, so have to do:

app.config.update(dict(
        routes_pathname_prefix='/APP/', 
        requests_pathname_prefix='/APP/'
    ))

perhaps this is what is causing the issue??

Fixed!

I needed to add:
app._assets_url_path = 'APP/assets'