Search code examples
djangofacebookauthenticationdjango-facebook

Getting django-facebook to work


I an trying to get django-facebook to work as per instructions given in the readme on https://github.com/tschellenbach/Django-facebook. I am new to django.

It looks simple but I am facing the following problems. I am not able to get it to work.

In the readme it says AUTH_USER_MODEL = 'member.FacebookUser'. I am guessing the right option is AUTH_USER_MODEL = 'django_facebook.FacebookUser' after importing the models - this took me some t even after making that change, syncdb throws an error stating that:

FacebookUser does not have a USERNAME_FIELD.

Not able to solve that I decided to use the default user model - auth.user. That works and I was able to load facebook/example. However after authentication from facebook, I get an error

You need to set AUTH_PROFILE_MODULE in your project settings

So I added AUTH_PROFILE_MODULE = 'django_facebook.FacebookProfile'

Now it returns a new error -

FacebookProfile matching query does not exist. Lookup parameters were {'user_id_exact': 2L}

What should I do now?


Solution

  • Do python manage.py syncdb or whatever it needs to be done to update your database schema with the new table (facebook_profile).

    Also, you don't mention it but I have and app that uses django_facebook and I have my settings.py file like this:

    TEMPLATE_CONTEXT_PROCESSORS = (
        ...
        'django_facebook.context_processors.facebook',
        ...
        )
    
    AUTHENTICATION_BACKENDS = (
        ...
        'django_facebook.auth_backends.FacebookBackend',
        )
    

    I hope it helps