用Python运行Heroku的Facebook应用程序教程时出现问题 [英] Problem running Heroku's Facebook app tutorial with Python

查看:189
本文介绍了用Python运行Heroku的Facebook应用程序教程时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试Heroku用Python编写Facebook应用程序的能力。我在运行基本教程时遇到问题。这似乎是这个问题值得问StackOverflow的情况下有一个答案,可以帮助其他人遇到完全相同的问题。



我遵循heroku的Facebook开发指示页面(http://devcenter.heroku.com/articles/facebook)。部署到Heroku工作正常。



但是,本地运行应用程序不。当我按照指示,并提出

$ p $ 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 |代码400,
消息错误的请求语法
('\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: p>

 的https://本地主机:5000 /代码= AQBPWpkbRdL2bt7KER0fcUS9ZnheXiGApkaF5MXbNgyIJqzw46SGve1iVyLIx1sDltNh0PkXPDdxhjAxoa1YED1cpcaflCXCkqzO27A-rhgjBpXwWUClpGRpRmDD2eIXcOyIczo_qGf45tbpvDZO5hFa0gmUeSHri4vY3bqw-5jBjZRoZfEB7pI8cLPOIsnNICI#_ = _ 

Safari认为它无法建立安全连接。



这是在OS X 10.6.8上运行的。 这是因为您的计算机没有在本地启用https,您可以启用此功能,也可以在本地主机上运行SSL。要做到这一点,你将编辑函数看起来像这样:

  def get_home():
return'http: //'+ request.host +'/'


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.

解决方案

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:

def get_home():
    return 'http://' + request.host + '/'

这篇关于用Python运行Heroku的Facebook应用程序教程时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆