Django-allauth Facebook Login
Install django-allauth first
$(venv) pip3 install django-allauth
now put this code in your installed applications in settings.py
'django.contrib.sites', 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.facebook',
Also, put the code below in settings.py
AUTHENTICATION_BACKENDS = ( 'allauth.account.auth_backends.AuthenticationBackend', 'django.contrib.auth.backends.ModelBackend', )
Also put them in settings.py
SOCIALACCOUNT_PROVIDERS = \ {'facebook': {'METHOD': 'oauth2', 'SCOPE': ['email','public_profile', 'user_friends'], 'AUTH_PARAMS': {'auth_type': 'reauthenticate'}, 'FIELDS': [ 'id', 'email', 'name', 'first_name', 'last_name', 'verified', 'locale', 'timezone', 'link', 'gender', 'updated_time'], 'EXCHANGE_TOKEN': True, 'LOCALE_FUNC': lambda request: 'kr_KR', 'VERIFIED_EMAIL': False, 'VERSION': 'v2.4'}}
The identifier and key can be found in https://developers.facebook.com/ create an application and go to DashBoard, you will see your
#facebook SOCIAL_AUTH_FACEBOOK_KEY = 'secret!'
You might want to add this
LOGIN_REDIRECT_URL = "/"
Now we need to change urls.py Add this code to urlpatterens
url(r'^accounts/',include('allauth.urls')),
Now go back to https://developers.facebook.com/ go to settings, click "Add Platform", click the website, put http: // localhost: 8000 / and click the quick launch button. go ahead and do what dev.facebook drives.
Now you need to set your site id in settings.py
#site id SITE_ID = <your local host site id>
We need to register our site ID and social application in our django admin. First, migrate and runerver
$(venv) python3 manage.py migrate
go to http: // localhost: 8000 / admin / and click the site ID change example.com to http: // localhost: 8000 (if you are already at the production level, you can just use your IP addresses or domain).

After saving the application, we are ready to log in using facebook. Put these template tags at the top of the html where you want your users to be logged in.
{% load socialaccount %} {% providers_media_js %}
and you can write this exact position where you want to make the login button
<a href="{% provider_login_url "facebook" method="js_sdk" %}">Login Button image</a>
This will send your request to the account / login page that processes your login procedures.
Link: https://medium.com/@jinkwon711/django-allauth-facebook-login-b536444cbc6b