Django-allauth is the high-ranking Django user system on GitHub. Originally through the comparison is to choose Django-userea, but Bo Master IQ is not enough to understand its installation configuration document ..... After messing up a test project, I had to put it down. Fortunately, the Allauth installation configuration is relatively simple. But its documentation is more chaotic ... A lot of key information is actually found in the FAQ ... Write down the memo.
1. Installation:
Copy the Code code as follows:
Pip Install Django-allauth
2. Configuration
settings.py
Copy the Code code as follows:
Template_context_processors = (
"Django.contrib.auth.context_processors.auth",
"Django.core.context_processors.debug",
"Django.core.context_processors.i18n",
"Django.core.context_processors.media",
"Django.core.context_processors.static",
"Django.core.context_processors.tz",
# "Django.contrib.messages.context_processors.messages"
# Required by Allauth template tags
"Django.core.context_processors.request",
# Allauth Specific Context processors
"Allauth.account.context_processors.account",
"Allauth.socialaccount.context_processors.socialaccount",
)
Authentication_backends = (
# Needed to login by username in Django Admin, regardless of ' allauth '
"Django.contrib.auth.backends.ModelBackend",
# ' Allauth ' specific authentication methods, such as login by e-mail
"Allauth.account.auth_backends. Authenticationbackend ",
)
Installed_apps = (
...
# The Django sites Framework is required
' Django.contrib.sites ',
' Allauth ',
' Allauth.account ',
' Allauth.socialaccount ',
# ... include the providers want to enable:
' Allauth.socialaccount.providers.amazon ',
' Allauth.socialaccount.providers.angellist ',
' Allauth.socialaccount.providers.bitbucket ',
' Allauth.socialaccount.providers.bitly ',
' Allauth.socialaccount.providers.coinbase ',
' Allauth.socialaccount.providers.dropbox ',
' Allauth.socialaccount.providers.facebook ',
' Allauth.socialaccount.providers.flickr ',
' Allauth.socialaccount.providers.feedly ',
' Allauth.socialaccount.providers.github ',
' Allauth.socialaccount.providers.google ',
' Allauth.socialaccount.providers.hubic ',
' Allauth.socialaccount.providers.instagram ',
' Allauth.socialaccount.providers.linkedin ',
' Allauth.socialaccount.providers.linkedin_oauth2 ',
' Allauth.socialaccount.providers.openid ',
' Allauth.socialaccount.providers.persona ',
' Allauth.socialaccount.providers.soundcloud ',
' Allauth.socialaccount.providers.stackexchange ',
' Allauth.socialaccount.providers.tumblr ',
' Allauth.socialaccount.providers.twitch ',
' Allauth.socialaccount.providers.twitter ',
' Allauth.socialaccount.providers.vimeo ',
' Allauth.socialaccount.providers.vk ',
' Allauth.socialaccount.providers.weibo ',
' Allauth.socialaccount.providers.xing ',
...
)
urls.py:
Copy the Code code as follows:
Urlpatterns = Patterns ("',
...
(R ' ^accounts/', include (' Allauth.urls ')),
...
)
This configures the settings and URL, and enters it in terminal.
Copy the Code code as follows:
Python manage.py makemigrations
Python manage.py Migrate
3. Initializing the use of
Start the local server, login admin
Identifies the site ID that the user system will service to as the site ID set in the current setting
Set up a Socialaccount app for every OAuth login interface
Fill in the site and interface provider's information
At this point access
http://127.0.0.1:8000/accounts/login/
If you have logged in before, please visit first
http://127.0.0.1:8000/accounts/logout/
You can see the default landing page without CSS. You can override the code in the
Path\to\your\virtualenv\lib\site-packages\allauth\templates
Each social networking site interface provider is set up in this
Http://django-allauth.readthedocs.org/en/latest/providers.html
More localized only Weibo and Live...github can count O (∩_∩) o
The above is the personal use of Django-allauth experience and configuration, if there are errors, please correct me