Cannot use shiny_prerendered Shiny server

19 views
Skip to first unread message

Alejandra Narváez Vallejo

unread,
Dec 4, 2023, 4:37:43 PM12/4/23
to Shiny - Web Framework for R

Hi everyone,
I have made a shiny dashboard with flexdashboard. I was having problems with the speed and I rewrite it to use the prerendered functionality. On my local computer it works and the speed has considerably increased. I use this command to run my application.

1 Sys.setenv(RMARKDOWN_RUN_PRERENDER = "0")
2 rmarkdown::run("layoutHORIZONTALtestv21v2Button4tests2ProposalRendered.Rmd")

I noticed that I needed line 1 to force not to rerender. The run function alone takes too much time so Line 1 speeds the process. The place where I got my "layoutHORIZONTALtestv21v2Button4tests2ProposalRendered.Rmd" also has the layoutHORIZONTALtestv21v2Button4tests2ProposalRendered.html

Now on our shiny server 1.5 , We tried this code first :

library(shiny)

Define server logic

shinyServer(function(input, output) {

Render the R Markdown document

rmarkdown::run("layoutHORIZONTALtestv21v2Button4tests2ProposalRendered.Rmd", output_format = "html_document", output_file = "shiny_app.html")
})

but it did not build the html data like when I run it locally.

So I copied the html on the same folder as the "layoutHORIZONTALtestv21v2Button4tests2ProposalRendered.Rmd". and run this

library(shiny)
Sys.setenv(RMARKDOWN_RUN_PRERENDER = "0")

Define server logic

shinyServer(function(input, output) {

Render the R Markdown document

rmarkdown::run("layoutHORIZONTALtestv21v2Button4tests2ProposalRendered.Rmd")

})

I am not sure if it is actually reading the html, but I do know that it is not working properly, because I have a css subfolder with a css file, and it is not being read. Locally this was working but on the server it only reads the css if it is located on the same folder as the "layoutHORIZONTALtestv21v2Button4tests2ProposalRendered.Rmd". This should not happen because according to the documentation : "For files referenced from the web document however, you need to be sure to place them within one of the following specially named sub-directories to ensure they can be located by the Shiny web server: css/ CSS stylesheets.

SO I have the following questions:

  1. Locally. Why is my rmarkdown::run function not working propertly and I am being forced to use Sys.setenv(RMARKDOWN_RUN_PRERENDER = "0") to speed the process up.
  2. shiny server: Why does the function rmarkdown::run does not built the html.
  3. shiny server: what is happening with the css
  4. shiny server : how can I win the functionality of prerendered .Rmd on my shiny server?

Thank you very much,

Alejandra

Reply all
Reply to author
Forward
0 new messages