Canvas演示(runwithfriends)总是重定向到我自己的GAE下的主页面 [英] Canvas demo (runwithfriends) always redirects to main page under my own GAE

查看:102
本文介绍了Canvas演示(runwithfriends)总是重定向到我自己的GAE下的主页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 runwithfriends 示例应用程序来学习画布编程和GAE。我可以将示例代码上传到GAE而没有任何错误。以下是我的config.py和app.yaml文件:

I'm using the runwithfriends example app to learn canvas programming and GAE. I can upload the sample code to GAE without any errors. Here are my config.py and app.yaml files:

# Facebook Application ID and Secret.
FACEBOOK_APP_ID = ''
FACEBOOK_APP_SECRET = ''

# Canvas Page name.
FACEBOOK_CANVAS_NAME = 'blah'

# A random token for use with the Real-time API.
FACEBOOK_REALTIME_VERIFY_TOKEN = 'RANDOM TOKEN'

# The external URL this application is available at where the Real-time API will
# send it's pings.
EXTERNAL_HREF = 'http://blah.appspot.com'

# Facebook User IDs of admins. The poor mans admin system.
ADMIN_USER_IDS = ['']



app.yaml



app.yaml

application: blah
version: 1
runtime: python
api_version: 1

handlers:
- url: /(.*\.(html|css|js|gif|jpg|png|ico))
  static_files: static/\1
  upload: static/.*
  expiration: "1d"

- url: .*
  script: main.py

- url: /task/.*
  script: main.py
  login: admin

访问其GAE上的演示应用程序工作很好当我采用完全相同的代码时,除了需要在我自己的GAE帐户下运行的更改外,该应用程序将无法正常工作我可以使用我的帐户登录应用,该应用显示在我的应用菜单下。所以,OAuth是好的。每次我访问主页面时,我总是重定向到iframe显示我使用的应用程序(无法显示该图像,runwithfriends应用程序超过配额,因为我键入),但不会去这个iframe:

Accessing the demo app on their GAE works just fine. When I take the exact same code, except for the changes I need to run under my own GAE account, the app won't work. I can login to the app using my account and the app shows up under my Apps menu. So, OAuth is good. Every time I go to access the main page, I'm always redirected to the iframe showing I use the app (can't show that image, runwithfriends app is over quota as I type this) but won't go to this iframe:

我已经看过并了解了网址路由的工作原理:

I've looked at and understand how url routing works:

def main():
    routes = [
        (r'/', RecentRunsHandler),
        (r'/user/(.*)', UserRunsHandler),
        (r'/run', RunHandler),
        (r'/realtime', RealtimeHandler),

        (r'/task/refresh-user/(.*)', RefreshUserHandler),
    ]
    application = webapp.WSGIApplication(routes,
        debug=os.environ.get('SERVER_SOFTWARE', '').startswith('Dev'))
    util.run_wsgi_app(application)

所有的处理程序都在那里看起来像corr ect post / get方法。我的GAE实例中没有记录错误,例如404或405.当我第一次使用 http:// localhost:8080 时,我看到大量的200s,没有别的

All the handlers are there with what looks like correct post/get methods. There are no errors logged in my GAE instance either, such as 404 or 405. When I first use http://localhost:8080, I see plenty of 200s and nothing else.

我开始使用dev_appengine.py,但由于我的HTTPS安全性设置,因此必须将开发移至GAE。我暂时禁用了HTTPS,但是始终会被重定向到apps.facebook.com/path,无论在dev_appengine.py中什么也不能保持所有开发。不知道这是否与我的问题有关。

I started out using dev_appengine.py but had to move development to GAE because of my HTTPS security setting. I disabled HTTPS temporarily but still always get redirected to the apps.facebook.com/path no matter what and can't keep all my development within dev_appengine.py. Don't know if that's related to my issue or not.

由于演示工作(当不超过配额时),我确定问题是我自己的GAE实例,或FB中的配置使用我的GAE,我只是因为我的生活无法弄清楚。我使用Eclipse与PyDev和GAE插件。

Since the demo works (when not over quota), I'm sure the problem is with my own GAE instance, or configuration within FB to use my GAE, I just for the life of me can't figure out. I'm using Eclipse with PyDev and GAE plugins.

添加应用程序的FB配置和窗口在我登录到应用程序后显示。

Adding the app's FB configuration and the window that's displayed after I login to the app.

沙盒:

重定向:

Redirects:

在我的GAE下运行,这是唯一返回的页面:

Running under my GAE, this is the only page that is returned:

推荐答案

我决定删除我的测试FB应用并重新创建它。当我进入我的密钥/秘密值是当我发现我的错误。我的问题是我的FB APP ID和SECRET - 两个单引号之间都有这样的空格:

I decided to delete my test FB app and recreate it. When I went to enter my key/secret values was when I found my error. My issue was with my FB APP ID and SECRET - both had a space between the single quotes like this:

# Facebook Application ID and Secret.
FACEBOOK_APP_ID = ' xxxxxxxxxxxxxxxxx'
FACEBOOK_APP_SECRET = ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

拥有空间正在拧紧东西,一旦我在conf.py中输入新值,我发现了额外的空格。正确的常数声明:

Having the space was screwing things up, once I went to enter the new values in conf.py I spotted the extra spaces. The correct constant declaration:

# Facebook Application ID and Secret.
FACEBOOK_APP_ID = 'xxxxxxxxxxxxxxxxx'
FACEBOOK_APP_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

测试FB应用程序现在工作。

Test FB App works now.

这篇关于Canvas演示(runwithfriends)总是重定向到我自己的GAE下的主页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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