Talk:PyFacebook Tutorial

From Facebook Developer Wiki

Jump to: navigation, search

Contents

[edit] Problems with this tutorial

[edit] Reference to file structure

The first problem with the tutorial itself (as opposed to the api) is that about half way through it starts referring to different names than it did at the beginning. The first half of the tutorial refers to the application subfolder of the Django project as "fbapp", and assumes the following folder structure:

fbsample/
    fbapp/
        templates/
            canvas.fbml
        __init__.py
        models.py
        urls.py
        views.py
    __init__.py
    manage.py
    settings.py
    urls.py

while the second half (beginning in the "URL MAPPINGS" sections) assumes the following file structure, without accounting for the difference:

fbsample/
    fb/
        __init__.py
        models.py
        views.py
    templates/
        canvas.fbml
    __init__.py
    manage.py
    settings.py
    urls.py

Note that fbapp seems to have become simply fb. Even more problematic, there is no longer a urls.py in the fb subdirectory, and the templates subdirectory is now directly under fbsample rather than nested in fbapp (which, as I noted, has unaccountably become fb).

Can anyone explain what's going on here?


Your issues are typos. There should be a urls.py in fb/, and fb/ should be named fbapp/. The important part is that templates is not a part of the app, and (like noted by the OP), allows for separation of appearance (template) and function (fbapp). If these are fixed soon by the OP, I'll fix them soon. 126586 11:31, 13 November 2007 (PST)

On another note, it should be mentioned in the tutorial a bit more about the facebook.require_login() decorator... the first thing one wants to do beyond the simplest is to generate views based upon an id, i.e. http://my.server.com/fbapp/13/ Setting this up with django via passing 13 as an optional argument to the view is standard and easy, but then you start trying to get to the specified url and require_login() redirects to the standard canvas, i.e. http://my.server.com/fbapp/. It's really easy to fix: require_login(next=1)... but discovering that in the documentation was nearly impossible. 126586 11:30, 13 November 2007 (PST)

[edit] =

[edit] Need to add application to profile

For the Django "post" example the application needs to be added to the profile. I had bookmarked the application instead of using
 <fb:add-section-button section="profile" /> 
to add the application to the profile. Maybe, there is a better way.


[edit] =

If using a Recent version of Django (1.0 or SVN) , you will need to edit the sample app so that maxlength becomes max_length

[edit] Simple non-django example?

It would be great to have a non-django example (ideally like the FB php example) to be able to get the basics w/o having to learn even more on top of the facebook API. (511695165 11:55, 18 January 2009 (PST))

Here is a simple Pylons example I created. http://jeffkuchta.com/index.php/2009/02/08/pylons-and-facebook-application-part-1/


Does someone has a copy of the tutorial above ? link seems to be broken, and I don't wan't to use django ...

reference