0
我使用python 2.7.6和django 1.6.5,我安装了django allauth,当我登录使用Facebook。 request.user是管理员我如何regeister和显示通过Facebook登录的用户的配置文件。而这个登录只能在我的电脑上,我希望把它在其他工作太当使用django allauth请求用户从Facebook登录时admin
我使用permission_classes在views.py 我的设置文件
SITE_ID = 3
INSTALLED_APPS = (
.
.
.
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
#'allauth.socialaccount.providers.google',
)
REST_FRAMEWORK = {
#'DEFAULT_PERMISSION_CLASSES': (
#'rest_framework.permissions.IsAuthenticated',
#),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'allauth.account.auth_backends.AuthenticationBackend',
)
}
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.social.associate_user',
'social_auth.backends.pipeline.social.load_extra_data',
'social_auth.backends.pipeline.user.update_user_details'
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
'django.contrib.auth.context_processors.auth',
'allauth.account.context_processors.account',
'allauth.socialaccount.context_processors.socialaccount'
)
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
SITE_ID = 1
LOGIN_REDIRECT_URL = "http://192.168.100.7/userprofile/"
FACEBOOK_APP_ID='my_app_id'
FACEBOOK_API_SECRET='my_app_secret_id'
FACEBOOK_EXTENDED_PERMISSIONS = ['email']
SOCIAL_AUTH_UID_LENGTH = 16
SOCIAL_AUTH_ASSOCIATION_HANDLE_LENGTH = 16
SOCIAL_AUTH_NONCE_SERVER_URL_LENGTH = 16
SOCIAL_AUTH_ASSOCIATION_SERVER_URL_LENGTH = 16
SOCIAL_AUTH_ASSOCIATION_HANDLE_LENGTH = 16
SOCIALACCOUNT_PROVIDERS = \
{
'facebook':
{
'SCOPE': ['email'],
'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
'METHOD': 'oauth2',
},
}
,我已经加入这一行的联合国网址。 PY “URL(R '^账户/',包括( 'allauth.urls')),”