Is there something like a working directory when deploying an app to shinyapps.io?
In my app directory I keep ui.r and server.r, as well as another directory for additional scripts (engine). What would be the path to that directory when the app is deployed on shinyapps.io?
Related
I'm new to 'golem'. So far I did my Shiny apps as packages, with the app in the folder inst/app, and then to use 'shinytest' I made a folder inst/app/shinytest. How to do with 'golem'? There's no app folder: inst/app only contains www, and the UI and the server are some functions in the package.
So I need to know where to put the 'shinytest' script and how to deal with 'testthat' and the expect_pass function? (I don't want to use testServer)
I've found. It suffices to create a file app.R in the app folder with these contents:
mypackage::run_app()
My shiny-server path has subfolders with files that should not be served. ie, it's like
/srv/shiny-server/
content_folder/
subfolder1/
file_that_should_not_be_served.csv
folder_that_should_not_be_served/
some_files_and_folders
inner_folder/
app.R
supporting_files
I need to serve http://localhost:3838/content_folder/subfolder1/inner_folder/ as shiny application, but need to throw some error (ideally notfound or unauthorized) when other folders/files are opened. eg, http://localhost:3838/content_folder/subfolder1/folder_that_should_not_be_served/ and http://localhost:3838/content_folder/subfolder1/file_that_should_not_be_served.csv should fail.
Is there a way to do this? I'm open to using proxy servers if that would help...
I am trying to publish R shiny app.But it is giving error that path should be to files within the project directory.
This is for R shiny .I have designed an app where I need to read csv files to it.App is running properly. But, when I am trying to publish it shinyappp server.It is throwing error that path to files should be within the project directory.
I am getting error that paths should to files within the project directory.
Is there a function or a way to retrieve the path of root home directory of a shiny app?
The shiny app I run creates multiple directories and changes working directory. But at point in the app, I need to jump to the home directory. getwd() won't work unless I run it first and save it as a variable or something.
I am thinking of something like the below command used to read a file from a package home directory on any platform without knowing the actual path.
#get root dir
system.file()
# read a file from the root dir of a package
a <- system.file("bla",package="foo")
The approach has to work locally, on shiny-server and shinyapps.io. (In situations where I cannot set the path manually).
I followed the same commands shown in shinyapps.io for uploading my app but I get the following error:
> library(shinyapps)
> shinyapps::deployApp("/Users/mona/CS764/demo")
Error in lint(appDir) : Cancelling deployment: invalid project layout.
The project should have one of the following layouts:
1. 'shiny.R' and 'ui.R' in the application base directory,
2. 'shiny.R' and 'www/index.html' in the application base directory,
3. An R Markdown (.Rmd) document.
Here's the structure of my files:
When using deployApp() you must deploy the directory containing your ui.R and server.R files (or shiny.R / www/index.html if using a custom UI). The files can not be a subdirectory.
Additionally, its important to note that any R files in the directory or any subdirectory will be parsed, so its important that they have valid syntax.