How to install django-allauth


Install Django


After you've activated a virtual environment, enter the command:

pip install django-allauth


modify settings.py

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

            'django.template.context_processors.request',

            ],
        },
    },
]

AUTHENTICATION_BACKENDS = (

    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',

)

INSTALLED_APPS = (

    'django.contrib.auth',
    'django.contrib.messages',

    'django.contrib.sites',

    'allauth',
    'allauth.account',
    'allauth.socialaccount',
)

SITE_ID = 1
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


django_project/django_project/urls.py

from django.contrib import admin
from django.urls import path
from django.conf.urls import include, url


urlpatterns = [
    path('admin/', admin.site.urls),
    url(r'^accounts/', include('allauth.urls')),
]


To apply migration, we need to run migrate command as follows

python manage.py migrate

 

run server

python manage.py runserver

 

open
http://127.0.0.1:8000/accounts/login

open
http://127.0.0.1:8000/accounts/signup/

 

https://django-allauth.readthedocs.io/en/latest/installation.html

 



Comments