托管 LAN Shiny 应用程序从命令行运行

编程入门 行业动态 更新时间:2024-10-27 05:22:21
本文介绍了托管 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 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 应用程序从命令行运行

本文发布于:2023-11-13 21:53:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585417.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令行   应用程序   LAN   Shiny

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!