Django: SocialApp matching query does not exist

I'm using django-allauth, and I configured localhost:9000/admin/ with the following details:

socialapp .
provider:
Name:
Client id:
App ID, or consumer key
Key:
Secret:  etc .

I set SITE_ID = 2 (because I changed the default site example.com to localhost:9000)

In settings.py:

   INSTALLED_APPS = (
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'django.contrib.messages',
        'django.contrib.staticfiles',
        'django.contrib.admin',
        'uni_form',
        'allauth',
        'allauth.account',
        'allauth.socialaccount',
        'bootstrapform',
        # 'allauth.socialaccount.providers.twitter',
        # 'allauth.socialaccount.providers.openid',
         'allauth.socialaccount.providers.facebook',
    )
    SOCIALACCOUNT_PROVIDERS = \
        { 'facebook':
            { 'SCOPE': ['email', 'publish_stream'],
              'AUTH_PARAMS': { 'auth_type': 'reauthenticate' },
              'METHOD': 'oauth2' ,
              'LOCALE_FUNC': 'path.to.callable'} }

When I go to:

http://localhost:9000/accounts/facebook/login

I get:

Error :  `SocialApp matching query does not exist.

What am I doing wrong?


Using the Django admin you need to create a SocialApp listing your Facebook app credentials. Make sure that this app is attached to the proper site (as in, django.contrib.sites.models.Site).

In your case, there needs to be a django.contrib.sites.models.Site instance with id=2 (check the sites admin) that is listed as a site for the SocialApp.

If either the SocialApp is missing, or if it is created but not attached to a site matching your settings.SITE_ID, then allauth does not know what app to pick, resulting in the error message you listed above.


For me, it showed this error when I had in settings.py:

SITE_ID = 1

It worked when I changed it to 2:

SITE_ID = 2