social_django集成第三方登录-1
参考文档:
https://python-social-auth.readthedocs.io/en/latest/
github:
https://github.com/python-social-auth/social-app-django
settings配置文件:
INSTALLED_APPS = (
...
'social_django',
...
)
AUTHENTICATION_BACKENDS = (
'social_core.backends.open_id.OpenIdAuth',
'social_core.backends.google.GoogleOpenId',
'social_core.backends.google.GoogleOAuth2',
'social_core.backends.google.GoogleOAuth',
'social_core.backends.twitter.TwitterOAuth',
'social_core.backends.yahoo.YahooOpenId',
...
'django.contrib.auth.backends.ModelBackend',
)
TEMPLATES = [
{
...
'OPTIONS': {
...
'context_processors': [
...
'social_django.context_processors.backends',
'social_django.context_processors.login_redirect',
...
]
}
}
]
补充内容:
urlpatterns = patterns('',
...
url('', include('social_django.urls', namespace='social'))
...
)
访问:
127.0.0.1:8000/login/weibo