error when trying to use social auth to register with twitter

I had this error when I tried to make the registration with twitter with social auth app:

TypeError at /login/twitter/ 
issubclass() arg 1 must be a class  

Does anybody have any idea what causes this? I copied all the mandatory things in the social auth docs and I'm getting this error.

Full traceback:

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/login/twitter/

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_social_auth-0.7.22-py2.7.egg/social_auth/decorators.py" in wrapper
      26.  redirect)
    File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.22-py2.7.egg/social_auth/backends/__init__.py" in get_backend
      935. get_backends(force_load=True)
    File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.22-                py2.7.egg/social_auth/backends/__init__.py" in get_backends
      914. if issubclass(backend, SocialAuthBackend):

Exception Type: TypeError at /login/twitter/
Exception Value: issubclass() arg 1 must be a class

settings.py :

AUTHENTICATION_BACKENDS = ( 
# 'fbregister.facebook.FacebookBackend',

'tager_www.views.CustomAuthentication',
'django.contrib.auth',
'django.contrib.auth.backends.ModelBackend'
'social_auth.backends.twitter.TwitterBackend',
'social_auth.backends.facebook.FacebookBackend',
'social_auth.backends.google.GoogleOAuthBackend',
'social_auth.backends.google.GoogleOAuth2Backend',
'social_auth.backends.google.GoogleBackend',
'social_auth.backends.yahoo.YahooBackend',
'social_auth.backends.browserid.BrowserIDBackend',
'social_auth.backends.contrib.linkedin.LinkedinBackend',
'social_auth.backends.contrib.disqus.DisqusBackend',
'social_auth.backends.contrib.livejournal.LiveJournalBackend',
'social_auth.backends.contrib.orkut.OrkutBackend',
'social_auth.backends.contrib.foursquare.FoursquareBackend',
'social_auth.backends.contrib.github.GithubBackend',
'social_auth.backends.contrib.vk.VKOAuth2Backend',
'social_auth.backends.contrib.live.LiveBackend',
'social_auth.backends.contrib.skyrock.SkyrockBackend',
'social_auth.backends.contrib.yahoo.YahooOAuthBackend',
'social_auth.backends.contrib.readability.ReadabilityBackend',
'social_auth.backends.contrib.fedora.FedoraBackend',
'social_auth.backends.OpenIDBackend',
'django.contrib.auth.backends.ModelBackend',

)

Answers


Short answer:

You should remove 'django.contrib.auth' from AUTHENTICATION_BACKENDS - it is not a backend, but module.

Explanation of the exception:

There is a code from django-social-auth:

for auth_backend in setting('AUTHENTICATION_BACKENDS'):
    mod, cls_name = auth_backend.rsplit('.', 1)
    module = import_module(mod)
    backend = getattr(module, cls_name)

if issubclass(backend, SocialAuthBackend):
    # ....

With 'django.contrib.auth', backend will become a module, not a class.


Second problem: it's just a typo - you forgot about , after 'django.contrib.auth.backends.ModelBackend'.


Need Your Help

Size of QByteArray is hard to compute?

qt qbytearray

Recently I programmed to do file transmission with Qt. Thought it worked now, I'm still curious about what happened. Please help me find out the reason. Many thanks.

How to change direction of drawing children of grid to Right_To_Left in Android

android gridview android-layout

Im trying to use grid but I need to change direction of inserting children from ( left to right ) to ( right to left ). is there any way to do so , simple example would help me more.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.