2016-07-01 4 views
1

현재 저는 소셜 인증을 고려중인 프로젝트에서 일하고 있습니다. (그래서 python-social-auth는 훌륭합니다). 또한, 내 자산을 처리하기 위해 django-pipeline을 통합하려고합니다 (주로 css).django-pipeline이 python social auth을 충돌합니다.

JS 사회적 가입을 수행 할 수

vm.doSocialAuth = function(provider) { 
    var authURL = '/auth/login/' + provider + '/?next=/auth/completed/'; 
    $window.open(authURL, 500, 500); 
}; 

사회 인증이 잘 작동합니다.

하지만 수행 할 때

INSTALLED_APPS += ['pipeline'] 
PIPELINE = { 
    # 'PIPELINE_ENABLED': True, # Missing this allows pipeline in debug mode 
    'STYLESHEETS': { 
     'main': { 
      'source_filenames': (
       'css/cover.css', 
      ), 
      'output_filename': 'css/main.css', 
      'extra_context': { 
       'media': 'screen,projection', 
      }, 
     }, 
    }, 
} 

그리고 나는이 예외가 트리거에서 사회적 기호를 만들려고 : 나는 python-에 대한 만약 문제를 모르는

ERROR Internal Server Error: /auth/complete/twitter/ 
Traceback (most recent call last): 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response 
    response = self.process_exception_by_middleware(e, request) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response 
    response = wrapped_callback(request, *callback_args, **callback_kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func 
    response = view_func(request, *args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view 
    return view_func(*args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/apps/django_app/utils.py", line 54, in wrapper 
    return func(request, backend, *args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/apps/django_app/views.py", line 28, in complete 
    redirect_name=REDIRECT_FIELD_NAME, *args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/actions.py", line 43, in do_complete 
    user = backend.complete(user=user, *args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/backends/base.py", line 41, in complete 
    return self.auth_complete(*args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/utils.py", line 229, in wrapper 
    return func(*args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/backends/oauth.py", line 182, in auth_complete 
    return self.do_auth(access_token, *args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/utils.py", line 229, in wrapper 
    return func(*args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/backends/oauth.py", line 193, in do_auth 
    return self.strategy.authenticate(*args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/strategies/django_strategy.py", line 96, in authenticate 
    return authenticate(*args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 74, in authenticate 
    user = backend.authenticate(**credentials) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/backends/base.py", line 82, in authenticate 
    return self.pipeline(pipeline, *args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/backends/base.py", line 85, in pipeline 
    out = self.run_pipeline(pipeline, pipeline_index, *args, **kwargs) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/backends/base.py", line 111, in run_pipeline 
    func = module_member(name) 
    File "/home/dosher/.venvsa/env_hrpro/lib/python2.7/site-packages/social/utils.py", line 55, in module_member 
    mod, member = name.rsplit('.', 1) 
ValueError: need more than 1 value to unpack 

social-auth library 또는 django-pipeline을위한 것입니다. 그래서 여기에 게시했습니다.

도움을 주시면 감사하겠습니다.

+0

내가 동정 :

그래서, 여기에 나의 SOCIAL_AUTH_PIPELINE입니다. 나는 장고 파이프 라인에 대한 많은 문제를 겪었으나 어디서부터 시작해야할지 모른다. – Wtower

+0

나는이 문제가 python-social-auth 저장소, https://github.com/omab/python-social-auth/pull/888에서 논의되었다는 것을 발견했다. – slackmart

답변

0

다음 답에 대한 크레딧은 모두 Julian Bez이고, 그는 this 개의 댓글을 게시했습니다.

그는 기본적으로 프로젝트 설정 파일에 SOCIAL_AUTH_PIPELINE 변수를 정의 할 것을 제안하고 python-social-auth는 django-pipeline과 원활하게 작동합니다.

settings.py

# By defining SOCIAL_AUTH_PIPELINE, we avoid a conflict between django-pipeline 
# and python-social-auth. 
SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details', 
    'social.pipeline.social_auth.social_uid', 
    'social.pipeline.social_auth.auth_allowed', 
    'social.pipeline.social_auth.social_user', 
    'social.pipeline.user.get_username', 

    # Send a validation email to the user to verify its email address. 
    # Disabled by default. 
    # 'social.pipeline.mail.mail_validation', 

    # Associates the current social details with another user account with 
    # a similar email address. Disabled by default. 
    # 'social.pipeline.social_auth.associate_by_email', 

    'social.pipeline.user.create_user', 
    'social.pipeline.social_auth.associate_user', 
    'social.pipeline.social_auth.load_extra_data', 
    'social.pipeline.user.user_details', 
)