Safari浏览器上的Shinyapps.io无法连接到服务器“ localhost”

时间:2019-01-15 15:18:07

标签: r shiny localhost shinyapps

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

问题似乎很直接。使用闪亮的apps.io,我可以查看应用程序日志,并确定我需要提供应用程序权限(特别是Shinyapps和tidyverse)才能将数据上传到Google表格,该表格由Google表格授权。这没问题,因为我在本地自己的计算机上执行了相同的过程:

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 can't open the page "the provided URL" because safari cannot connect to the server "localhost"

我基本上希望此应用程序只能由允许的Google帐户使用,该帐户是共享帐户,并且最多可以从3种不同的Windows机器上载,任何帮助!

1 个答案:

答案 0 :(得分:0)

由于我利用了R中的Google表格包,因此在我的代码中找到了一个临时解决方法,它称为:

gs_title("worksheet title") 

这使应用程序可以识别已获得该应用程序访问权限的工作表,但是当在线上载该应用程序时这是一个问题,我使用了另一个函数:

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

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