Django-allauth is the top-ranked Django user system on GitHub. Originally by contrast 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 drop it. Fortunately Allauth installation configuration is relatively simple. But its documentation is more cluttered ... A lot of key information is actually found in the FAQ ... Write down the memo.
1. Installation:
Copy Code code as follows:
Pip Install Django-allauth
2. Configure
settings.py
Copy 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 through 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 you 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 Code code as follows:
Urlpatterns = Patterns ("",
...
(R ' ^accounts/', include (' Allauth.urls ')),
...
)
The settings and URLs are configured to enter in the terminal
Copy Code code as follows:
Python manage.py makemigrations
Python manage.py Migrate
3. Initialize the use of
Start the local server, and then login admin
Identify the site ID that the user system will serve as the site ID set in the current settings
Set up a Socialaccount app for each OAuth landing interface
Fill in the information for the site and interface provider
Access at this time
http://127.0.0.1:8000/accounts/login/
If you've 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 rewrite the code in the
Path\to\your\virtualenv\lib\site-packages\allauth\templates
Each social networking site interface provider is set up here
Http://django-allauth.readthedocs.org/en/latest/providers.html
The more localized only microblogging and Live...github can be counted O (∩_∩) o
This is the personal experience and configuration of Django-allauth, if there is a mistake, please correct me.