Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app$get_asset_url() - usage unclear, causes errors #261

Open
daattali opened this issue Jun 14, 2021 · 0 comments
Open

app$get_asset_url() - usage unclear, causes errors #261

daattali opened this issue Jun 14, 2021 · 0 comments

Comments

@daattali
Copy link
Contributor

I'm having an issue with/unsure how to use app$get_asset_url(). Could an example usage (in R) be shown?

Steps I tried to do:

  • Initiate a Dash app with library(dash); library(dashHtmlComponents); app <- Dash$new()
  • Created an "assets" folder in the working directory and added a css file "test.css" to it with the contents body { background: red; }
  • Tried calling app$get_asset_url("test.css") in the console, I got the following error message: "application not started via source(), and DASH_APP_PATH environment variable is undefined"
  • Therefore, I defined that envvar to the current folder using Sys.setenv("DASH_APP_PATH" = normalizePath(getwd())) and I tried running the same line. I still got the same error (this means the error is wrong - the envvar is now defined)
  • I tried saving a "test.R" file with library(dash); library(dashHtmlComponents); app <- Dash$new(); app$get_asset_url("test.css") and source-ing the file. Now I get an error "the asset path 'test.css' is not valid; please verify that this path exists within the 'assets' directory." (**this error also seems incorrect, as I do have that css file inside an assets directory)

@alexcjohnson mentioned that "get_asset_url is only really important when the app is being served with a path prefix."

It would be very helpful to see an example usage of this function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant