0

I have installed python-social-auth==0.3.6. Then I migrated and got an error:

from social_django.models import AbstractUserSocialAuth, UserSocialAuth, Nonce, Association, Code, DjangoStorage
ImportError: No module named 'social_django'
nik_m
  • 11,825
  • 4
  • 43
  • 57
Rifa84
  • 21
  • 1
  • 6
  • also i have installed: pip install python-social-auth[django] and pip install social-auth-app-django. but the same error occurs. Django version ==1.10.5 – Rifa84 Mar 25 '17 at 08:49
  • If you `pip freeze` what do you get? – nik_m Mar 25 '17 at 09:59
  • (bookmarks) C:\Python34>pip freeze defusedxml==0.5.0 Django==1.10.6 django-allauth==0.31.0 oauthlib==2.0.2 Pillow==2.9.0 PyJWT==1.4.2 python-social-auth==0.3.6 python3-openid==3.1.0 requests==2.13.0 requests-oauthlib==0.8.0 six==1.10.0 social-auth-app-django==1.1.0 social-auth-core==1.2.0 – Rifa84 Mar 25 '17 at 10:26
  • That's strange. I have the exact same virtualenv and works brilliantly, without errors. Have you actually used this package inside your project, somewhere? – nik_m Mar 25 '17 at 10:49
  • Actually as i told I am beginner. so i am doing this project with the help of the book. I had a lot of problem and I solved them, but this one is really difficult for me. about the package-could specify which package pls – Rifa84 Mar 25 '17 at 10:52
  • Did not help. the same error. – Rifa84 Mar 25 '17 at 11:13

2 Answers2

0

[UPDATE]: What worked for me was this:

  1. In a clean virtualenv I pip install python-social-auth[django]
  2. I included 'django_social', in my INSTALLED_APPS
  3. I run migrations, ./manage.py migrate

You need to install python-social-auth[django]:

pip install python-social-auth[django]

And then add 'social.apps.django_app.default' to your INSTALLED_APPS.

Then don't forget to run the migrations: ./manage.py migrate

nik_m
  • 11,825
  • 4
  • 43
  • 57
  • ISTALLED_APPS:INSTALLED_APPS = [ 'account', 'images', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'social.apps.django_app.default', but the same error – Rifa84 Mar 25 '17 at 08:54
  • AUTHENTICATION_BACKENDS:AUTHENTICATION_BACKENDS = ( 'social.backends.facebook.Facebook2OAuth2', 'social.backends.google.GoogleOAuth2', 'social.backends.twitter.TwitterOAuth', 'django.contrib.auth.backends.ModelBackend', 'account.authentication.EmailAuthBackend', – Rifa84 Mar 25 '17 at 08:55
  • Did you `pip install social-auth-app-django` ? – nik_m Mar 25 '17 at 08:58
  • yes i have installed pip install social-auth-app-django – Rifa84 Mar 25 '17 at 09:03
  • You have `Django` installed, don't you? `pip install Django` – nik_m Mar 25 '17 at 09:05
  • I have Django installed==1.10.5 and also I installed pip install soical-auth-app-django and added 'social.apps.django_app.default' to INSTALLED_APPS, then made migration but the same error – Rifa84 Mar 25 '17 at 09:09
  • Did not got u.sorry I am begginer in django. could you specify your recommendation – Rifa84 Mar 25 '17 at 09:46
  • Have you checked [this](http://stackoverflow.com/questions/41635052/python-social-auth-with-django-importerror-no-module-named-social-django)? – nik_m Mar 25 '17 at 09:48
  • The same erro. Ye i have checked – Rifa84 Mar 25 '17 at 09:54
0

I resolve with

pip install django-rest-framework-social-oauth2==1.0.4 social-auth-core==0.2.1 python-social-auth==0.2.21 django-oauth-toolkit==0.10.0
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Helton Wernik
  • 185
  • 2
  • 3