Installation configuration for DJANGO-ALLAUTH social user systems

Source: Internet
Author: User
Tags install django pip install django
Django-allauth integrates the local user system and the social user system. its social user system can be attached to multiple accounts. It is also a very popular Djangouser system, we will briefly introduce here, share the personal use experience DJANGO-ALLAUTH is github above the ranking of the django user system. the comparison was intended to use django-userea, but the blogger's IQ was not enough to understand its installation and configuration documents ..... after messing up a test project, let's stop. fortunately, allauth has relatively simple installation and configuration. however, its documentation is messy... A lot of key information is found in the FAQ... record down the memo.

1. installation:

The code is as follows:


Pip install django-allauth

2. configuration

Settings. py

The code is 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 'allowu'
"Django. contrib. auth. backends. ModelBackend ",

# 'Alliute' 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 ',

'Allowute ',
'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. faces ',
'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. incluin_oau2 ',
'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. Weaver ',
'Allauth. socialaccount. providers. Xing ',
...
)

Urls. py:

The code is as follows:


Urlpatterns = patterns ('',
...
(R' ^ accounts/', include ('allauth. URLs ')),
...
)

After settings and url are configured, enter

The code is as follows:


Python manage. py makemigrations
Python manage. py migrate


3. initialization

Start the local server and log on to admin

Determine the website id that the user system will serve as the website id set in the current settings
Set a social account app for each oauth login interface
Enter the site and interface provider information

Access

Http: // 127.0.0.1: 8000/accounts/login/
If you have logged in before, visit
Http: // 127.0.0.1: 8000/accounts/logout/
You can see the default login page without css. you can rewrite the code in

PATH \ TO \ YOUR \ VIRTUALENV \ Lib \ site-packages \ allauth \ templates
Each social network interface provider is set here
Http://django-allauth.readthedocs.org/en/latest/providers.html
Only Weibo and live... github are localized. can they be counted as "O (zhu_zhu) O "?

The above is my personal experience and configuration of Django-allauth. please correct me if any errors occur.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.