开发者

How do I get PyFacebook working with the Google App Engine Patch?

I've tried to follow the advice of this question: Facebook, Django, and Google App Engine, however I've run into a number of problems. The first is that from facebook.djangofb import facebook doesn't work because when I try to use the decorator @facebook.require_login(), it complains that the facebook module doesn't have that method. If I change it to import facebook.djangofb and @facebook.djangofb.require_login(), it works. Any ideas that's going on there?

Then, even with that, I experience the same problem as in this question: app-engine-patch and pyFacebook not working.

It seems like a lot of people have done this, so is there a good example of how to combine PyFacebook and 开发者_运维技巧App Engine Patch?


For your first question:

from facebook.djangofb import facebook doesn't work because when I try to use the decorator @facebook.require_login(), it complains that the facebook module doesn't have that method. If I change it to import facebook.djangofb and @facebook.djangofb.require_login(), it works.

Well, seems like require_login is on facebook.djangofb not on facebook.djangofb.facebook.

So you can do:

import facebook.djangofb
@facebook.djangofb.require_login()
...

or

from facebook import djangofb
@djangofb.require_login()
...

or

from facebook.djangofb import require_login
@require_login()
...

For the second question, did you try the answer of the other question (not using require_login at all, using request.fb.check_session(request) instead)? What do you get?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜