1

django-social-auth에서 python-social-auth로 프로젝트를 포팅합니다. 나는 문서의 instructions을 따라,하지만 난 프로젝트의 테스트 (./manage.py 테스트) 나는 다음과 같은 오류 얻을 실행하려고하면django-social-auth에서 python-social-auth로 이식 할 때 현장 사용자를위한 접근 자

Creating test database for alias 'default' ... 
CommandError: One or more models did not validate: 
default.usersocialauth: Accessor for field 'user' clashes with related field 'User.social_auth'. Add a related_name argument to the definition for 'user'. 
default.usersocialauth: Reverse query name for field 'user' clashes with related field 'User.social_auth'. Add a related_name argument to the definition for 'user'. 

./manage.py syncdb를 작업을 마이그레이션 ./manage을 (문서에서 언급했듯이) python-social-auth의 모델 테이블 이름이 django-social-auth에서 사용되는 모델 테이블과 호환되도록 정의 되었기 때문에 예상대로 데이터를 마이그레이션 할 필요가 없다.

+0

'INSTALLED_APPS'에 libs가 설치되어 있고 정의되어있을 가능성이 있습니까? – omab

+0

안녕하세요. 답장을 보내 주셔서 감사합니다. INSTALLED_APPS에서 django-social-auth을 제거했습니다. 다음은 제 3의 설치된 응용 프로그램 목록입니다.'INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites' , 'django.contrib.messages', 'django.contrib.sitemaps', 'django.contrib.staticfiles', 'django.contrib.humanize', '등록', '벌', '장고 .contrib.admin ', '건초 더미 ', '남쪽 ', 'djcelery ', 'django_extensions ', 'social.apps.django_app.default ', 'sorl.thumbnail ' )'다시 한 번 감사드립니다. – DanielS

+1

지금 작동합니까? – omab

답변

4

같은 문제가 있습니다.

django-social-auth 라이브러리가 INSTALLED_APPS에서 제거되었지만 django-social-auth 및 python-social-auth가 동일한 related_name 매개 변수를 사용하여 동일한 외래 키를 사용하기 때문에 django는 여전히 충돌을 발견했습니다.

모델이 파이썬 - 사회 - 인증 라인 (148)에

get_validation_errors (validation.py) 

에 중단 점을 넣어 'R'을보고 150

for r in rel_opts.get_all_related_objects(): 
    if r.field is not f: 
     if r.get_accessor_name() == rel_name: 
      e.add(opts, "Accessor for field '%s' clashes with related field '%s.%s'. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.get_accessor_name(), f.name)) 
     if r.get_accessor_name() == rel_query_name: 
      e.add(opts, "Reverse query name for field '%s' clashes with related field '%s.%s'. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.get_accessor_name(), f.name)) 

변수가 계시와 충돌되어 정확히 알고 충돌하고있는 관련 객체.

라이브러리에서 django-social-auth를 완전히 제거하면 문제가 해결됩니다. 원래는 easy_install을 설치 한 이후

, 나는 또한 PIP 제거를 사용할 수 있습니다 easy_install.pth

에서 이름을 제거하기 위해 사이트 패키지에서 제거뿐만 아니라 기억은 rm -rf를 사용

희망이 도움이됩니다.