如何在 Google App Engine 上本地测试 Facebook 应用程序(代码 191 错误)?

发布于 2024-12-06 13:15:55 字数 763 浏览 1 评论 0原文

我想在本地测试和开发应用程序,同时让应用程序上线,并且我不想使用两个单独的应用程序 ID,因为这意味着每次部署新版本时我都必须更改代码,然后再将其更改回来。

我知道我可以更改主机文件,以便 localdev.{{my application URL}} 引用 localhost 并且 URL 将有效,因此我不会得到 191 代码,但会得到Google App Engine 启动器强制我使用端口 8080,而这无法在主机文件中定义。如果我尝试输入 localdev.{{my application URL}}:8080 我会再次收到 191 错误代码。

有没有办法将端口 80 与 Google App Engine 启动器一起使用?

或者还有其他解决方案吗?

更新:

  1. 我设法使用 Google App Engine 目录中的 Python 文件(而不是 Google App Engine 启动器 GUI)在端口 80 上本地运行。但是,Facebook 无法将 localdev.{{my application URL}} 识别为 URL,并且仍然给出相同的错误代码 191。

  2. 一旦我将主机文件更改为 < code>{{my application URL}} 不带“localdev”。它起作用了,所以这必定意味着 URL 必须完全匹配,而不仅仅是域。这是真的吗?无论如何,这不是最佳选择,因为这意味着我必须一直更改主机文件,但这是您可以忍受的东西...

I want to test and develop locally, while having the application on the air, and I'd rather not use two separate application id's because this means I have to change the code every time I deploy a new version and then change it back.

I understand that I can change the host file so that localdev.{{my application URL}} would refer to localhost and the URL will be valid, so I won't get the 191 code, but the Google App Engine launcher forces me to use port 8080, and this can't be defined in the host files. If I try to enter localdev.{{my application URL}}:8080 I get the 191 error code again.

Is there any way to use port 80 with the Google App Engine launcher?

Or is there another solution?

UPDATES:

  1. I managed to run locally on port 80 by using the Python file from the Google App Engine directory and not the Google App Engine launcher GUI. However, Facebook doesn't recognize localdev.{{my application URL}} as the URL, and it still gives me the same error code, 191.

  2. Once I changed the host file into {{my application URL}} without the "localdev." it worked, so this must mean the URLs must match exactly, and not just the domain. Is this true? Anyway, it isn't optimal, because it means I have to change the host file all the time, but it's something you can live with...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丶情人眼里出诗心の 2024-12-13 13:15:56

我有 2 个 Facebook 应用程序,其中一个包含我的真实 URL(用于生产),另一个包含 http://127.0.0.1/(用于开发)。然后我的代码中有一个实用函数,它检查 self.request.host 并选择适当的应用程序 ID 和密钥。

我使用 http://127.0.0.1/ 而不是 http://localhost/http://localhost:8080/ 是我只发现http://127.0.0.1/ 可以在 Internet Explorer 中工作(其他浏览器似乎可以很好地处理其他两个 URL,只要它们与脸书应用程序)。

I have 2 Facebook apps, one with my real URL (for production), and one with http://127.0.0.1/ (for development). Then I have a utility function in my code which checks self.request.host, and selects the appropriate app id and secret.

The reason I use http://127.0.0.1/ and not http://localhost/ or http://localhost:8080/ is that I found only http://127.0.0.1/ would work in Internet Explorer (other browsers seemed fine with those other two URLs, provided they matched the Facebook app).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文