سؤال

I have installed django-allauth, after that this is my settings.py

Django_apps = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)

Third_party_apps = (
    'avatar',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'bootstrapform',
    'allauth.socialaccount.providers.github',
    'allauth.socialaccount.providers.twitter',
)

My_apps = ()

INSTALLED_APPS = Django_apps + Third_party_apps +  My_apps

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    "django.core.context_processors.request",
    "allauth.account.context_processors.account",
    "allauth.socialaccount.context_processors.socialaccount",
)
AUTHENTICATION_BACKENDS = (
    "django.contrib.auth.backends.ModelBackend",
    "allauth.account.auth_backends.AuthenticationBackend",
)
ACCOUNT_ADAPTER ="allauth.account.adapter.DefaultAccountAdapter"
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "optional"
ACCOUNT_USERNAME_MIN_LENGTH = 3

and i believe i also correctly set my urls.py. And also i have two Social app from django admin with correct twitter and github api keys and secrets.

But then problem is whenever i click to login via twitter it shows me the correct twitter auth page and after i authorize the app it gives me this error..

<allauth.socialaccount.models.SocialLogin object at 0x7feb5875a650> is not JSON serializable

and also i get almost the same error with github. like

<allauth.socialaccount.models.SocialLogin object at 0x7feb5877a590> is not JSON serializable

, So please help me to understand what's the problem

هل كانت مفيدة؟

المحلول

In Django 1.6 you have to change the SESSION_SERIALIZER parameter to pickle. Put this in your settings.py:

SESSION_SERIALIZER='django.contrib.sessions.serializers.PickleSerializer'

I don't know when allauth will become compatible with this new Django serialization format. See Django 1.6 release notes.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top