Cheatsheet to get started with Django-allauth
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md

README.md

Django-allauth-help

Cheatsheet to get started with Django-allauth

author = "Akash Ranjan"

To setup and use django-allauth (Django 1.8)

You can read about the configurations and all other setups here

sudo pip install django-allauth

  • Go to /usr/local/lib/python2.7/dist-packages/allauth/ and copy the templates folder into your project
  • This templates folder can later be modified for customised login/signup page

configuration for settings.py

Add:

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',
)

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['your/template/directory/in/your/project'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                #other predifined context_processors
                ...
                'django.template.context_processors.request',
                ...
            ],
        },
    },
]


INSTALLED_APPS = (
		'allauth',
		'allauth.account',
 		'allauth.socialaccount',
		'allauth.socialaccount.providers.google',
	)


#django-allauth configurations
SITE_ID = 4 #depending upon the site number.. that can be found at localhost:8000/admin/sites/ just hover over your site name

#Theses are the basic configuration that i found useful
http://django-allauth.readthedocs.org/en/latest/configuration.html

ACCOUNT_USER_MODEL_USERNAME_FIELD = "username"
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = True
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_USERNAME_MIN_LENGTH = 4
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 1
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True
ACCOUNT_LOGOUT_ON_GET = True
ACCOUNT_CONFIRM_EMAIL_ON_GET = True

SOCIALACCOUNT_QUERY_EMAIL = True
SOCIALACCOUNT_STORE_TOKENS = True

LOGIN_REDIRECT_URL = "/"

For urls.py

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

Helpful URLs


This much will do :)


U P D A T E

You can now do alot more with django prebuilt modules,

  1. djangorestframework-jwt
  2. django-rest-auth
  3. Update required for newer version of django-allauth