ImportError using django-social-auth

I am trying to use django-social-auth to implement google openid login into my app, my problem is that I get this error:

TemplateSyntaxError at /login Caught ImportError while rendering: cannot import name get_backend Request Method: GET Request URL: ############################# Django Version: 1.3.1 Exception Type: TemplateSyntaxError Exception Value:
Caught ImportError while rendering: cannot import name get_backend Exception Location: /home/group018/web/WSProject/social_auth/ in , line 19 Python Executable: /usr/bin/python2.7 Python Version:

Into the exception location you can see the hierarchy of my project.

that is as follows:

from functools import wraps from django.http import HttpResponseRedirect, HttpResponse,HttpResponseServerError from django.core.urlresolvers import reverse from django.contrib.auth import login, REDIRECT_FIELD_NAME from django.contrib.auth.decorators import login_required from django.contrib import messages from django.utils.importlib import import_module from django.views.decorators.csrf import csrf_exempt from WSProject.social_auth.utils import sanitize_redirect, setting, log,backend_setting, clean_partial_pipeline from WSProject.social_auth.backends import get_backend DEFAULT_REDIRECT = setting('SOCIAL_AUTH_LOGIN_REDIRECT_URL') or setting('LOGIN_REDIRECT_URL') LOGIN_ERROR_URL = setting('LOGIN_ERROR_URL', setting('LOGIN_URL')) RAISE_EXCEPTIONS = setting('SOCIAL_AUTH_RAISE_EXCEPTIONS', setting('DEBUG')) PROCESS_EXCEPTIONS = setting('SOCIAL_AUTH_PROCESS_EXCEPTIONS','social_auth.utils.log_exceptions_to_messages') def dsa_view(redirect_name=None): . . .

the function get_backend is defined into WSProject/social_auth/backends/ and I have try to put:

from WSProject.social_auth.backends.__init__ import get_backend

But it doesn't work... any idea?

Note that the import below to the one I said is working

SOLVED: Finally I did it, the problem was the libraries, they were not correclty installed as jpic said.

-------------Problems Reply------------

Did you try this ?

from social_auth.backends import get_backend

You should not hardcode the name of your project in your code. That makes the code less portable.

If that doesn't work, then you haven't install django-social-auth correctly. Fix your setup:

  1. Create a virtualenv, in the parent directory of your project seems fair: virtualenv /path/to/venv
  2. Activate the virtualenv: source /path/to/venv/bin/activate
  3. Install an app ie. from git: pip install -e git+git://

I also wrote a more detailed article on django, virtualenv and pip which should be of your interrest.

Category:python Views:0 Time:2012-03-05

Related post

  • Namespace Error on django-social-auth 2011-01-08

    I've added django-social-auth in my django project from the instructions on this page but when I accesed /login/google/ I encountered an error: NoReverseMatch at /login/google/ 'namespace' is not a registere

  • Django-Socialauth or django-social-auth, which one is the best? 2011-03-18

    I am looking for a Django application to implement Facebook-connect, and I have found 2 options that look pretty stable: They seem to be forks of each other, but

  • django-social-auth incorrect authentication service 2011-06-06

    I was trying to use django-social-auth today, but turned out I got an error everytime I tried to login using it. I was using the example found in its git master branch, put in my facebook keys, but when I click to login using facebook, the error "Inc

  • How can I handle Exceptions raised by django-social-auth? 2011-06-24

    In django-social-auth, there are a few instances where a backend will raise a ValueError (such as when a user cancels a login request or if a user tries to associate with an account that's already been associated with another User). If a User runs in

  • How to show user a form to set username when using django with django-social-auth 2011-07-16

    I've been using django-social-auth (, with some success - logging in from Twitter and Facebook have been set up without difficulty. However, when I log in from some OpenID providers, I am faced with an empty

  • multiple auth with django-social-auth 2011-07-28

    I have a django (v1.2.5) project with 2 apps. I authenticate the user in the first app with regular Django User. I want to be able to login into the second app with django-social-auth (v0.4.2) when the User will be some Contact model in my second app

  • django-social-auth app not working under virtualenv 2011-08-09

    I shifted my django project to a virtualenv. I installed django-social-auth library using pip. I copied the same files that were working outside virtualenv to the new environment, but I am getting a Caught NoReverseMatch while rendering: Reverse for

  • Django-social-auth google oauth token usage 2011-08-19

    I'm using Django-socila-auth plugin. It uses google API for Oauth 1.0 Authentication. Question is have anybody used it with google python API (gdata). I mean how to apply auth session_token, stored in django-social-auth model to my api call. Can you

  • Using the OAuth Access Token from django-social-auth with Google data api (calendar) 2011-09-21

    I'm trying to use the OAuth Token I get from django-social-auth to access the users calendars. So in the django-social-auth configuration I set: GOOGLE_CONSUMER_KEY = 'anonymous' GOOGLE_CONSUMER_SECRET = 'anonymous' GOOGLE_OAUTH_EXTRA_SCOPE = ['https

  • Login Template for django-social-auth 2011-10-26

    I have successfully installed django-social-auth. I entered the API keys and it is even working. But now I do not know how to create a login template where I can provide both social login as well as traditional registration. I have the links for soci

  • django-social-auth django-registration and django-profiles - together 2011-10-26

    Has anyone used django-social-auth, django-registration and django-profiles together. Do they work well together? I have established social-auth but I read somewhere that django-allauth is better. Should I switch over to that? Please advise Update: I

  • Django-social-auth and twitter update status 2011-10-27

    I want create application with django-social-auth. How can I get users possibility update twitter status? I try to use tweepy, but it write me: Invalid / expired Token I use consumer_key and consumer_secret from my application, and oauth_token with o

  • How to set up django-social-auth for website authentication 2011-11-01

    Is there any easy and fully documented way of configuring django-social-auth( documentation is so incomplete.Templates are missing and what's up with all urls? --------------Solutions------------- Fi

  • In django-social-auth, can't get the Facebook authentication link to show? 2011-12-06

    I've installed django-social-auth. It seems to work except I only have random authentication links show up in the list of authentication options. In the oAuth list, I can only see: Google-Oauth Linkedin Github Orkut I'm trying to get Facebook authent

  • can't login with twitter using django-social-auth 2011-12-06

    I'm using django-social-auth app ( for social authentication. I provided the consumer_key and consumer_secret to the app. when I write the link that logins to twitter

  • Django Social Auth giving "Incorrect authentication service" error when trying to login via Twitter 2012-01-14

    I'm sure there aren't too many people on the site that have experience with this but I'm going to get it a shot. I tried installing Django Social Auth for social authentication on a site I am designing but when ever I try logging in using any of the

  • How do I add custom fields to a User when using django-social-auth 2012-01-14

    I need to add a BooleanField and a ManyToManyField to my users. I'm using django-social-auth. It seems I could use 'CustomUser'. I guess that's what it's for, but how do I take it into use? I would need to know: where to define these new fields How t

  • Fetching facebook data once logged in using django-social-auth 2012-01-14

    We've set up an application that uses the django-social-auth extension to authenticate users with Facebook. The authentication works fine, but we are not clear on how to go about fetching useful information from Facebook (friends lists, likes, etc.)

  • How can I override/extend the "pipeline" flow used in django-social-auth? 2012-01-14

    This is discussed in this thread but it looks like it hasn't been documented yet. I'm ultimately trying to create the following Facebook Connect sign-up flow: User connects to Facebook (such that django-social-auth gets an access token but doesn't ye

Copyright (C), All Rights Reserved.

processed in 0.167 (s). 11 q(s)