How to edit django-allauth default templates?

Sebastian Tare B. picture Sebastian Tare B. · Aug 18, 2016 · Viewed 13.3k times · Source

i'm using Django 1.10 and i want to add the allauth's app for login, signin, etc, to my website. I've installed allauth from pip, and tried to put the templates from allauth repository inside my templates folder and call them but i don't know how to make it work.

Answer

TitanFighter picture TitanFighter · Aug 23, 2016

The correct answer can be found here: https://stackoverflow.com/a/31282443/4992248

  1. Create yourproject/templates/allauth/account/ and paste here all templates you need to edit from /myproject/Lib/site-packages/allauth/templates/account.

If you need to make changes for socialaccount templates, create also yourproject/templates/allauth/socialaccount/

  1. Edit 'DIRS' in settings.py like 'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'templates', 'allauth')],

At the end it should look somethink like this:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'templates', 'allauth')],
        'APP_DIRS': True,
        'OPTIONS': {
            'debug': False,
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.template.context_processors.media',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
  1. You never should do any code changes at /Lib/site-packages/*, because all changes are lost once a package is updated.