Talk:PythonPyFacebookTutorial

From Facebook Developers Wiki

Jump to: navigation, search

[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)