Django: SocialApp matching query does not exist

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

In my case, on the Add social application page, I forgot to select my site as "Chosen sites" 🤦🏼‍♂️

See screenshot below (on the bottom right is the Chosen Sites list): enter image description here


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.