托管 LAN Shiny 应用程序从命令行运行 [英] Hosting LAN Shiny apps run from command line

查看:51
本文介绍了托管 LAN Shiny 应用程序从命令行运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在连接到 LAN 的机器上托管 Shiny 应用程序.在我的应用程序所在的目录中,我有 server.R、ui.R 和 launcher.R 脚本.launcher.R 文件如下所示:

I am trying to host a Shiny app on a machine hooked up to a LAN. In the directory housing my app, I have the server.R, ui.R, and launcher.R scripts. The launcher.R file looks like:

#!/usr/bin/Rscript
library(shiny)
setwd("~/path/to/shinyApp/")
shiny::runApp(host="0.0.0.0",port=4414)

当我通过 RStudio 运行此应用程序时,该应用程序会启动,运行正常,并且其他机器可以通过 LAN 访问 987.65.43.21:4414,方法是在浏览器中转到 987.65.43.21:4414.当我使用 launch.browser=T 运行应用程序时,地址显示为 127.0.0.1:4414.

When I run this via RStudio, the app launches, behaves normally, and can be accessed by other machines through the LAN by going to 987.65.43.21:4414 in a browser. When I run the app with launch.browser=T, the address reads 127.0.0.1:4414.

我希望能够在不运行 RStudio 的情况下运行启动器并托管应用程序.当我尝试通过命令行运行启动器代码时,应用程序会给出通常的消息

I want to be able to run the launcher and host the app without RStudio running. When I try running the launcher code via command line, the app gives the usual messages

Loading required package: methods
Listening on http://0.0.0.0:4414

但我无法通过 LAN 浏览器访问该应用程序.如果我导航到主机上的 127.0.0.1:4414,我可以访问它,但不能像运行 RStudio 时那样通过另一台机器上的机器 IP 访问它.

but I cannot access the app through a LAN browser. If I navigate to the 127.0.0.1:4414 on the host machine, I can access it, but not via the machine's IP on another machine like I could when running RStudio.

有没有人对可能发生的事情有任何见解?谢谢!

Does anyone have any insight on what could be going on? Thanks!

推荐答案

此处 这将允许您从局域网访问闪亮的应用程序.只需将您的闪亮文件放在 /srv/shiny-server/myApp 中,您就可以通过 xx.xx.xx.xx:3838/myApp/

Install shiny-server from here this will allow you to access your shiny apps from your LAN. Just put your shiny files in /srv/shiny-server/myApp and you can access them through xx.xx.xx.xx:3838/myApp/

这篇关于托管 LAN Shiny 应用程序从命令行运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆