Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit django-allauth default templates?

Tags:

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.

like image 484
Sebastian Tare B. Avatar asked Aug 18 '16 03:08

Sebastian Tare B.


People also ask

What is Allauth in Django?

Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.


1 Answers

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

In 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.
like image 67
TitanFighter Avatar answered Oct 15 '22 15:10

TitanFighter