使用 Python 运行 Heroku 的 Facebook 应用程序教程时出现问题
我正在测试 Heroku 使用 Python 编写 Facebook 应用程序的能力。我在运行基本教程时遇到问题。似乎这个问题值得在 StackOverflow 上询问,以防有答案可以帮助遇到完全相同问题的其他人。
我按照 Heroku 的 Facebook 开发页面 (http://devcenter.heroku.com/articles/facebook) 上的说明进行操作。部署到 Heroku 效果很好。
但是,在本地运行该应用程序则不然。当我按照说明操作并启动时,
http://localhost:5000
我会进入 Facebook 登录屏幕。但是当我单击该屏幕上的“登录”时,我得到:
SSL 连接错误 无法与 服务器。这可能是服务器的问题,或者可能需要 您没有的客户端身份验证证书。错误107 (net::ERR_SSL_PROTOCOL_ERROR):SSL 协议错误。
控制台输出为
09:55:07 web.1 | https://localhost:5000/ 09:55:07 web.1 |
https://www.facebook.com/dialog/oauth?client_id=179852202088814&redirect_uri=https://localhost:5000/&scope=user_likes,user_photos,user_photo_video_tags
09:55:07 web.1 | 127.0.0.1 - - [24/Sep/2011 09:55:07] "GET / HTTP/1.1"
302 - 09:59:02 web.1 | 127.0.0.1 - - [24/Sep/2011 09:59:02] code 400,
message Bad request syntax
('\x16\x03\x00\x00U\x01\x00\x00Q\x03\x00N}\xe2&\xf9\xf7"\x15\xd5\xb6\xf6\xa6\x0f\xb01\x97N\xcc\xb3l\xed\x97\xd1!-\x91c?\x1f\xac\xa2h\x00\x00*\x00\xff\x00\x88\x00\x87\x009\x008\x00\x84\x005\x00E\x00D\x00f\x003\x002\x00\x96\x00A\x00\x04\x00\x05\x00/\x00\x16\x00\x13\xfe\xff\x00')
09:59:02 web.1 | 127.0.0.1 - - [24/Sep/2011 09:59:02]
"UQN}?&??"ն??1?N̳l??!-?c???h*???98?5EDf32?A/??" 400 -
当我在 Safari 中尝试时,地址栏显示以下非常长的 URL:
https://localhost:5000/?code=AQBPWpkbRdL2bt7KER0fcUS9ZnheXiGApkaF5MXbNgyIJqzw46SGve1iVyLIx1sDltNh0PkXPDdxhjAxoa1YED1cpcaflCXCkqzO27A-rhgjBpXwWUClpGRpRmDD2eIXcOyIczo_qGf45tbpvDZO5hFa0gmUeSHri4vY3bqw-5jBjZRoZfEB7pI8cLPOIsnNICI#_=_
Safari compains that it can't建立安全连接。
它在 OS X 10.6.8 上运行。
I am testing Heroku's ability to write a Facebook app with Python. I'm having a problem running the basic tutorial. It seemed like this question was worth asking on StackOverflow in case there's an answer that helps other people who run into the exact same problem.
I followed the instructions on heroku's facebook development page (http://devcenter.heroku.com/articles/facebook). Deploying to Heroku worked fine.
However, running the app locally does not. When I follow the instructions and bring up
http://localhost:5000
I get to the Facebook Login screen. But when I click Log In on that screen, I get:
SSL connection error Unable to make a secure connection to the
server. This may be a problem with the server, or it may be requiring
a client authentication certificate that you don't have. Error 107
(net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
and the console output is
09:55:07 web.1 | https://localhost:5000/ 09:55:07 web.1 |
https://www.facebook.com/dialog/oauth?client_id=179852202088814&redirect_uri=https://localhost:5000/&scope=user_likes,user_photos,user_photo_video_tags
09:55:07 web.1 | 127.0.0.1 - - [24/Sep/2011 09:55:07] "GET / HTTP/1.1"
302 - 09:59:02 web.1 | 127.0.0.1 - - [24/Sep/2011 09:59:02] code 400,
message Bad request syntax
('\x16\x03\x00\x00U\x01\x00\x00Q\x03\x00N}\xe2&\xf9\xf7"\x15\xd5\xb6\xf6\xa6\x0f\xb01\x97N\xcc\xb3l\xed\x97\xd1!-\x91c?\x1f\xac\xa2h\x00\x00*\x00\xff\x00\x88\x00\x87\x009\x008\x00\x84\x005\x00E\x00D\x00f\x003\x002\x00\x96\x00A\x00\x04\x00\x05\x00/\x00\x16\x00\x13\xfe\xff\x00')
09:59:02 web.1 | 127.0.0.1 - - [24/Sep/2011 09:59:02]
"UQN}?&??"ն??1?N̳l??!-?c???h*???98?5EDf32?A/??" 400 -
When I try it in Safari, the address bar shows the following very long URL:
https://localhost:5000/?code=AQBPWpkbRdL2bt7KER0fcUS9ZnheXiGApkaF5MXbNgyIJqzw46SGve1iVyLIx1sDltNh0PkXPDdxhjAxoa1YED1cpcaflCXCkqzO27A-rhgjBpXwWUClpGRpRmDD2eIXcOyIczo_qGf45tbpvDZO5hFa0gmUeSHri4vY3bqw-5jBjZRoZfEB7pI8cLPOIsnNICI#_=_
Safari compains that it can't establish a secure connection.
This is running on OS X 10.6.8.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为 https 未在您的计算机上本地启用,您可以启用此功能,也可以在本地主机上不使用 SSL 的情况下运行。为此,您需要编辑该函数,使其类似于:
This is because https is not enabled locally on your machine, you could enable this or you could alternatively run without the SSL on your localhost. To do this you would edit the function to look something like: