Shiny Dashboard를 개발했습니다. 반응성 파일 판독기 등을 통해 가져온 여러 데이터 프레임이 있습니다. 또한 downloadButton을 사용하여 "Generate PDF"버튼을 추가했습니다.) 내 코드에 .R 코드. 내 server.R 코드는 downloadHandler()를 구현하여 해당 요청을 처리합니다.Shiny DownloadButton() 및 downloadHandler() 500 오류
내 Windows 바탕 화면에서이 모든 작업이 완벽하게 작동합니다. 이 설정을 Linux 서버에서 실행하고 싶습니다. 물론 몇 가지 경로를 수정해야했고 Shiny Server는이 상자에서 루트로 실행됩니다. Linux 서버에서 실행되는 사이트에서 "Generate PDF"버튼을 클릭하면 거의 즉시 HTTP 500 오류가 발생합니다. 필자는 Linux 서버에서 수동으로 pdfReport.Rmd 파일을 컴파일했으며 제대로 실행됩니다. 나는 두 가지 중 하나를 추측하고
: 그것은 Windows 바탕 화면처럼
- 은 어떻게 든 데이터가 리눅스 박스에 같은 방식으로 전달 받고 있지 않습니다. 아마 그렇지는 않지만 가능성이 있습니다.
- 임시 파일에 PDF 생성이 시작될 때 시스템에 기능이 없거나 파일을 쓸 경로가 존재하지 않아 내 경로에 문제가 있습니다. 아마도 내 downloadHandler() 코드가 어떤 식 으로든 형식이 잘못되었습니다. 나는 이것이 # 1보다 더 높은 가능성이라고 생각한다. 여기
은 downloadHandler (내 코드)입니다 : 내가 경로 그냥 쓰기 아니라고 생각 했을까
output$pdfReport <- downloadHandler(
# For PDF output, change this to "report.pdf"
filename = reactive({paste0("/srv/shiny-server/itpod/","ITPOD-",Sys.Date(),".pdf")}),
content = function(file) {
# Copy the report file to a temporary directory before processing it, in
# case we don't have write permissions to the current working dir (which
# can happen when deployed).
tempReport <- file.path("/srv/shiny-server/itpod", "pdfReport.Rmd")
file.copy("report.Rmd", tempReport, overwrite = TRUE)
params <- list(ilp=updateILP(), ico=updateICO(), sec=updateSecurity(), ppwc=updateWorkPreviousPeriodCompleted(),
pow=updateOngoingWorkCABApproved(), pwcr=updatePlannedWorkCABRequested(), epca=updateEmergencyChangesPendingCABApproval(),
fac=updateFacilities(), drs=updateDRStatus(), ov=updateOperationalEvents(), sl=updateStaffLocations(),
w = updateWeather())
# Knit the document, passing in the `params` list, and eval it in a
# child of the global environment (this isolates the code in the document
# from the code in this app).
rmarkdown::render(tempReport, output_file = file, params = params, envir = new.env(parent = globalenv())
)
}
)
, 그래서 나는 TMP/해당 변경하려하지만, 작동하지 않았다 어느 한 쪽.
http://my.url.com:3838/itpod/session/d661a858f5679aba26692bc9b4442872/download/pdfReport?w=
나는이 문제가 있는지 궁금해하기 시작하고 난 것을 해요 : 주위를 파고, 나는 내가 "PDF를 생성"버튼 위에, 나는 "세션"과 긴 URL을 얻을 때 발견 현재 세션이나 다른 무언가의 경로에 쓰지 않습니까? 이것은 샤이니에게 새로운 영역입니다. 내가 말했듯이, 내 바탕 화면에서 잘 작동하지만 일단 Linux 서버에 배포하면 제대로 작동하지 않습니다. 어떤 도움이라도 대단히 감사 할 것입니다. 미리 감사드립니다!