plotly / Dash.jl

Dash for Julia - A Julia interface to the Dash ecosystem for creating analytic web applications in Julia. No JavaScript required.
MIT License
488 stars 40 forks source link

favicon.ico returning 500 in PackageCompiler.jl compiled app #156

Open etpinard opened 2 years ago

etpinard commented 2 years ago

We've been playing with Dash.jl + PackageCompiler.jl recently and things are working pretty well!

Thanks very much for the efforts that went into https://github.com/plotly/Dash.jl/pull/131

One small problem we've encountered has been with the favicon. Currently we get

image

in the frontend and

image

on the backend.

I suspect this has to do with the hardcoded path in

https://github.com/plotly/Dash.jl/blob/e6d713df8a57bac9fc09e61e45d5b896f560eedd/src/handler/processors/default_favicon.jl#L3

which isn't relocatable in PackageCompiler.jl compiled apps.


I'd be willing to submit a PR (or PRs) to fix the problem. I suspect the "best" solution would be to move the favicon in the DashCoreResources repo and replace joinpath(ROOT_PATH, ...) with the corresponding artifact"" statement.

Looking forward to hearing what you have to say here.


Moreover, let me know if you need a reproducible example. I didn't provide one initial as I thought the error logs were enough to pinpoint the bug.

Related https://github.com/plotly/Dash.jl/issues/108

cc @Felix-Gauthier

waralex commented 2 years ago

Hi! Yeah, I hadn't thought of that. I'll try to get to the beginning of the trail. weeks to update the resource generator and move favicon to Core Resources

etpinard commented 3 months ago

Update

The easiest way to workaround the problem is to add a favicon.ico file in the Dash app's assets folder and use RelocatableFolders.jl e.g like:

using Dash
using RelocatableFolders: @path

const ASSETS_FOLDER = @path joinpath(@__DIR__, "..", "assets")

app = dash(; assets_folder=ASSETS_FOLDER)