嗨,我正在尝试通过 facebook 登录我的网站。我正在使用 django-social-auth 。
我的设置部分是:
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'))
在模板中:
<a rel="nofollow" href="{% url 'socialauth_begin' 'facebook' %}">facebook</a>
错误跟踪是这样的:
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
28. raise WrongBackend(backend)
Exception Type: WrongBackend at /login/facebook/
Exception Value: Incorrect authentication service "facebook"
我做错了什么?我应该怎么做才能解决它?