📅  最后修改于: 2023-12-03 14:40:45.948000             🧑  作者: Mango
Django Allauth is a flexible and extensible authentication system for Django. It is an easy-to-use package that provides social authentication, email authentication, and local account authentication. It can be used as a complete authentication back-end solution or can be customized to fit the specific needs of the application.
Django Allauth provides the following key features:
To install Django Allauth, run the following command:
pip install django-allauth
Add 'allauth'
and 'allauth.account'
to your INSTALLED_APPS
setting in the settings.py
file:
INSTALLED_APPS = [
...
'allauth',
'allauth.account',
...
]
Include the urls.py
file for allauth
in your project's urls.py
file:
urlpatterns = [
...
path('accounts/', include('allauth.urls')),
...
]
Django Allauth provides several settings that can be configured to fit the specific needs of the application. Some of the common settings are:
ACCOUNT_EMAIL_VERIFICATION
: Determines whether email verification is required for the user account. Possible values are mandatory
, optional
, and none
.SOCIALACCOUNT_PROVIDERS
: A dictionary of social account providers with their respective settings.ACCOUNT_AUTHENTICATION_METHOD
: Determines the authentication method used for local accounts. Possible values are username
, email
, and username_email
.Django Allauth provides customizable templates for login and signup pages. These templates can be overridden by creating a new template in the templates
directory of the application with the same name.
The following templates are available:
account/login.html
: Login pageaccount/signup.html
: Signup pageaccount/password_reset.html
: Password reset pageaccount/password_reset_done.html
: Password reset done pageDjango Allauth provides easy-to-use social authentication back-ends for popular social network providers. These back-ends can be enabled by adding the respective provider to the SOCIALACCOUNT_PROVIDERS
setting.
The following social authentication back-ends are available:
facebook
: Facebookgoogle
: Googletwitter
: Twitterlinkedin
: LinkedInDjango Allauth provides email verification functionality for local accounts. When ACCOUNT_EMAIL_VERIFICATION
is set to mandatory
, the user has to verify their email address before the account can be used.
Django Allauth is a flexible and extensible authentication system that provides social authentication, email authentication, and local account authentication. It is easy to use and can be customized to fit the specific needs of the application. It is a great choice for any Django application that requires authentication.