-1

Hi I am trying to do facebook login to my site. I am using django-social-auth for it.

My settings part is:

FACEBOOK_APP_ID = 'facebook app id here'
FACEBOOK_API_SECERET = 'api secret here'

FACEBOOK_EXTENDED_PERMISSIONS = ['email', 'user_location', 'user_photos']

AUTHENTICATION_BACKENDS = (
    'social_auth.backends.facebook.FacebookBackened',
)

LOGIN_URL = '/account/login/'
LOGIN_REDIRECT_URL = '/account/post_login/'

in urls:

url(r'', include('social_auth.urls'))

and in template:

<a rel="nofollow" href="{% url 'socialauth_begin' 'facebook' %}">facebook</a>

the error trace is this:

Request Method: GET
Request URL: http://127.0.0.1:8000/login/facebook/

Django Version: 1.5.1
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'grappelli',
 'django.contrib.admin',
 'south',
 'djrill',
 'bootstrapform',
 'djcelery',
 'djcelery_email',
 'social_auth',
 'smbhero',
 'apps.common',
 'apps.account',
 'apps.company',
 'apps.content')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/mnt/www/smb/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/mnt/www/smb/local/lib/python2.7/site-packages/social_auth/decorators.py" in wrapper
  26.                                                       redirect)
File "/mnt/www/smb/local/lib/python2.7/site-packages/social_auth/backends/__init__.py" in get_backend
  994.         get_backends(force_load=True)
File "/mnt/www/smb/local/lib/python2.7/site-packages/social_auth/backends/__init__.py" in get_backends
  971.             backend = getattr(module, cls_name)

Exception Type: AttributeError at /login/facebook/
Exception Value: 'module' object has no attribute 'FacebookBackened'

what is it that i am doing wrong ? what should i do to fix it ?

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
vijay shanker
  • 2,517
  • 1
  • 24
  • 37
  • 1
    You edited the question, but your edit is actually the problem; so I rolled your edit back. Otherwise the answer doesn't make any sense. – Burhan Khalid Sep 12 '13 at 06:21

2 Answers2

2

You spelled Backend wrong (FacebookBackened). Change it to:

    'social_auth.backends.facebook.FacebookBackend',
David Robinson
  • 77,383
  • 16
  • 167
  • 187
0

make sure that you installed python-social-auth with the following command pip install python-social-auth[django]

python-social-auth with Django: ImportError: No module named 'social_django'

You could then try replacing: 'social_auth.backends.facebook.FacebookBackened', with: 'social.backends.facebook.FacebookOAuth2'

In the "urls.py" of the project try this url: url('social-auth/', include('social.apps.django_app.urls', namespace='social')

In the project's main settings.py file make sure you have this included in the INSTALLED_APPS list, 'social.apps.django_app.default'...

This worked for me after receiving "AttributeError at /login/facebook/ 'module' object has no attribute 'FacebookBackened'"

Paddy Popeye
  • 1,634
  • 1
  • 16
  • 29