【问题标题】:Shinyapps.io on safari browser cannot connect to server "localhost "Safari 浏览器上的 Shinyapps.io 无法连接到服务器“localhost”
【发布时间】:2019-06-09 15:16:44
【问题描述】:

我已经在 Shiny 中创建了一个基本应用程序,它连接数据并将数据上传到共享的 googlesheet。该应用程序在本地运行良好,但是当我尝试在网络浏览器中运行它时,它不会上传任何数据。

这个问题看起来很简单。使用闪亮的apps.io我可以查看应用程序日志,它确定我需要提供应用程序权限(特别是shinyapps和tidyverse)才能将数据上传到谷歌表格授权的谷歌表格。这没问题,因为我在本地自己的机器上经历了相同的过程:

1) I'm running on a Mac, OSX Mojave v 10.14.2 
2) I've enabled web sharing via the terminal with sudo apachectl start (I think that's all it took?)
3) I've scoured similar problems on here. 
4) The app opens and uploads data when I "view in browser" from the RStudio IDE
5) I wanted to try Shiny Server, however apparently they haven't written anything for Macs yet that doesn't have to built from source, which is way beyond my level.
6) The google sheet is published to the web as well.

这是来自 shinyapps.io 日志提供的消息

Listening on http://127.0.0.1:37073
2019-01-15T14:33:32.976569+00:00 shinyapps[636194]: Adding .httr-oauth to .gitignore
2019-01-15T14:33:33.012405+00:00 shinyapps[636194]: Please point your browser to the following url: 
2019-01-15T14:33:33.010168+00:00 shinyapps[636194]: Waiting for authentication in browser...
2019-01-15T14:33:33.010485+00:00 shinyapps[636194]: Press Esc/Ctrl + C to abort
2019-01-15T14:33:33.012759+00:00 shinyapps[636194]: "This is the provided URL"

I then go to the provided URL, that takes me to a accounts.google page that asks me to provide authentication to a specific google account, which I do.

然后我从 safari 收到此错误:

Safari can't open the page "the provided URL" because safari cannot connect to the server "localhost"

我基本上希望这个应用程序只能由允许的 google 帐户使用,该帐户是一个共享帐户,并且能够从最多 3 台不同的 windows 机器上传,感谢任何帮助!

【问题讨论】:

  • 这个问题是在浏览器中托管还是在完全发布(或两者兼有)时出现?
  • @Chabo 只是在浏览器中托管时,它已完全发布在 shinyapps.io 中。

标签: r shiny localhost shinyapps


【解决方案1】:

我在我的代码中找到了一个临时解决方法,因为我利用了 R 中的 google sheet 包,它作为一个名为的函数:

gs_title("worksheet title") 

这允许应用程序识别已被授予访问应用程序的工作表,但是这是在线上传应用程序时出现的问题,我使用了一个不同的函数:

gs_url("worksheet URL as copied from search bar")

它传递了工作表的 url,显然绕过了本地服务器问题,并允许我从其他机器打开应用程序。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-04
    • 2015-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-17
    相关资源
    最近更新 更多