0

ImportError at /complete/twitter/ No module named social.pipeline i had this error when i was trying to connect twitter to my project this is the full traceback any body has any idea how to solve it

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/complete/twitter/?            oauth_token=gqaWZAszthiQJEUaZHF72U1y7hGimCLGSGxr6YLUU&oauth_verifier=YAkKy9Q71YrScl1psUXBApx   XeQITAcDm6ObCoxdjc

Django Version: 1.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'tager_www',
'fbregister',
'captcha',
'django_twilio',
'social_auth')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in    get_response
115.                         response = callback(request, *callback_args,    **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py" in    wrapped_view
77.         return view_func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-   py2.7.egg/social_auth/decorators.py" in wrapper
29.             return func(request, request.social_auth_backend, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-   py2.7.egg/social_auth/views.py" in complete
41.         return complete_process(request, backend, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/views.py" in complete_process
107.     user = auth_complete(request, backend, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/views.py" in auth_complete
190.     return backend.auth_complete(user=user, request=request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/twitter.py" in auth_complete
87.             return super(TwitterAuth, self).auth_complete(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/__init__.py" in auth_complete
656.         return self.do_auth(access_token, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/__init__.py" in do_auth
672.         return authenticate(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/__init__.py" in authenticate
59.             user = backend.authenticate(**credentials)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/__init__.py" in authenticate
107.         out = self.pipeline(pipeline, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/__init__.py" in pipeline
132.             mod = import_module(mod_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module
35.     __import__(name)

Exception Type: ImportError at /complete/twitter/
Exception Value: No module named social.pipeline

form settings.py :

SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.associate.associate_by_email',
'social_auth.backends.pipeline.misc.save_status_to_session',
'social.pipeline.redirect_to_form',
'social.pipeline.username',
'social_auth.backends.pipeline.user.create_user',
'social_auth.backends.pipeline.social.associate_user',
'social_auth.backends.pipeline.social.load_extra_data',
'social_auth.backends.pipeline.user.update_user_details',
'social_auth.backends.pipeline.misc.save_status_to_session',
'social.pipeline.redirect_to_form2',
'social.pipeline.first_name',
)
  • Show `PIPELINE` from _social_auth/backends/\_\_init\_\_.py_. And `'SOCIAL_AUTH_PIPELINE'` from `settings.py`, if exists. – awesoon May 02 '13 at 07:38
  • @soon done adding SOCIAL_AUTH_PIPELINE from settings.py – user2287768 May 02 '13 at 07:47
  • The problem with `'social.pipeline...'` lines. Are you sure, that `social.pipeline` module exists? – awesoon May 02 '13 at 07:54
  • @soon yeah it does it's a folder inside the app – user2287768 May 02 '13 at 07:59
  • Try the import on a django shell, if it raises an import error there, then the import path is wrong, once you get the correct import path use that value in the settings. – omab May 02 '13 at 16:07
  • @omab the thing is that it redirects to twitter and sends a url and then redirects back to 127.0.0.1 then it gives that error – user2287768 May 02 '13 at 18:03
  • @omab and please can you illustrate more the solution ur saying – user2287768 May 02 '13 at 18:24
  • The error happens because the problem is in the pipeline which is used in the complete process (the one fired when the user gets back to your site from the auth provider). The problem clearly is caused by a wrong import path in the pipeline setting, so I suggest to try that same import part in a django shell, so start one with `python manage.py shell` and then try doing `from social.pipeline import redirect_to_form, username, redirect_to_form2, first_name`. That should drop an `ImportError`, try different import paths until you have it working, then use that same import path in the setting. – omab May 02 '13 at 20:21
  • @omab sorry if it's a dumb question but i'm new in using django the perpose of all this is to make a regisistration through twitter in my website socould you please suggest what to do? also there are somethings in the app that i don't udestand like for instance what is the pipline – user2287768 May 02 '13 at 20:37
  • @omab another question please should i be the 1 creating social.pipline or that is somthing built in the app because it seems that django couldn't see it? – user2287768 May 02 '13 at 20:41
  • There's a default pipeline built into DSA with the needed behavior to register/login users using social sites. If you don't know what it is, then remove the `SOCIAL_AUTH_PIPELINE` setting, did you copied it from some place? – omab May 02 '13 at 23:19

1 Answers1

1

Not directly related to the question, but this is the only related page Google showed when searching for this error so I'll post this hoping that someone making the same mistake will see it. The error I was getting was:

ImportError at /complete/facebook/
No module named pipeline.social_auth

I got this error because I was trying to use the django-social-auth pipelines with python-social-auth. If you are using python-social-auth, you will need the following:

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',
    #'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'
)

More details can be found here.

Vlad Schnakovszki
  • 8,434
  • 6
  • 80
  • 114