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.
-
Possible duplicate of [How to override template in django-allauth?](http://stackoverflow.com/questions/18791136/how-to-override-template-in-django-allauth) – TitanFighter Aug 23 '16 at 01:31
-
Check this detailed and easy to follow answer stackoverflow.com/a/62773971/8260949 – Vivek Singh Jul 07 '20 at 11:28
-
1Use https://github.com/danihodovic/django-allauth-ui – danihodovic May 31 '22 at 21:24
9 Answers
The correct answer can be found here: https://stackoverflow.com/a/31282443/4992248
- 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/
- Edit
'DIRS'
insettings.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',
],
},
},
]
- You never should do any code changes at
/Lib/site-packages/*
, because all changes are lost once a package is updated.

- 4,582
- 3
- 45
- 73
-
This did not work for me. Change I need to make were either copy `yourproject/templates/allauth/account/` to `/myproject/Lib/site-packages/allauth/account` or change `os.path.join(BASE_DIR, 'templates', 'allauth')` to `os.path.join(BASE_DIR, 'templates', 'allauth', 'templates')`. Hope this helps – pravin May 12 '18 at 13:53
-
@pravin the 1st way is definitely bad - you will lose all changes during update of `allauth`. Regarding the 2nd way - either you use not standard path or the structure of `django` or `allauth` has been changed (`django` I use very rarely, `allauth` last time I used 1 year ago). – TitanFighter May 12 '18 at 18:43
-
@TitakFighter, As you stated the problem could be due to changes over different versions over the year. Went through a couple of other solutions given here and other similar question on SO. Most seem to have tried solution and were not successful in getting it up and end up doing complicated things. However the solution is just a minor tweak to the above solution. Thats the reason for the comment. Thanks – pravin May 13 '18 at 00:13
-
why would you add `allauth` to your `'DIRS'` when you're putting the new templates under the `template\allauth\account` folder? wouldn't `os.path.join(BASE_DIR, 'templates')` included all sub folders? see https://stackoverflow.com/a/9571112/895810 – dangel Aug 23 '19 at 02:07
-
@dangel it was long time ago. As I remember for some reason it did not work in my case. Unfortunately I do not remember this reason. – TitanFighter Aug 23 '19 at 08:53
-
This answer is more clear than the answer in the link it refers to. Other answers elsewhere forget to mention step 1. – manpikin Nov 01 '19 at 08:24
This worked for me using Django 2.1.7 and django-allauth 0.39.1:
In the folder
yourapp/templates/
create a folder namedaccount
so at the end the structure isyourapp/templates/account/
and add all templates that you want to override likelogin.html
orsignup.html
.In
settings.py
my Template Dirs remain the same'DIRS': [os.path.join(BASE_DIR, 'templates')],

- 1
- 1

- 91
- 2
- 5
It seems that the documentation of the module is out of date. For Django 1.10 you should do the following:
- download the module with pip
- add the following to INSTALLED_APPS(/settings.py file)
'django.contrib.sites', # first place
'allauth', # after your modules declarations
'allauth.account',
'allauth.socialaccount',
- add the backends declarations and another stuff needed by allauth
AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'allauth.account.auth_backends.AuthenticationBackend', ) SITE_ID = 1 ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_USERNAME_REQUIRED = True
seems that for django 1.10 is not needed to modify TEMPLATES section (django-allauth==0.28.0). You can verify the modules versions using the "pip freeze" command.
create an artificial module to override the templates; for example, my project is named irj_app and I've add a new application called _shared, then i have the following structure, and add it to INSTALLED_APPS before 'allauth' declarations :
irj_app / _shared
- i've created a templates directory inside "_shared" folder and i've added a file called "base.html" that overrides the allauth template. what i'd found is that django-allauth creates a template that overrides the layout that you've made before, then you need to intercept the django-allauth templates to change this behavior. Also you can override any template of this authentication mechanism. For example i have:
irj_app / _shared / templates / base.html
irj_app / _shared / templates / account / base.html
irj_app / _shared / templates / account / signup.html
irj_app / _shared / templates / _shared / adminlte-template / ... (template for other modules)
hope it helps

- 945
- 8
- 11
-
note that I could not get the above to work when I accidentally had the following directory structure (instead of the above) irj_app / _shared / templates / allauth / base.html (nb 'allauth' directory) – andyw Mar 07 '17 at 16:16
Try This:
Create account directory in your app's template dir so that it looks like below
yourppname/templates/account
and files
yourppname/templates/account/login.html
yourppname/templates/account/signup.html
and add below to your TEMPLATE DIRS Remember to change yourappname to your app's name
os.path.join(BASE_DIR, 'yourappname', 'templates')
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'yourappname', 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

- 646
- 2
- 6
- 16
Like many have already told here, all we have to do is bring the account,openid and socialaccount folders from the templates folder of allauth into the templates folder of our project folder.
But one thing to keep in mind while adding the
'DIRS': [os.path.join(BASE_DIR, 'project_name','templates')]
to the setting is that, the BASE_DIR in django points to the directory where manage.py is stored. And it is at this level we have our project folder and our templates folder within the project. So we need to add our 'project_name' and then 'templates' to the DIRS with os.path.join

- 152
- 1
- 8
-
This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31010966) – Richard Kenneth Niescior Feb 13 '22 at 07:02
-
The direct answer has already been posted on this page by multiple people, I'm just sharing a tip to implement that solution properly. – Sangeeth Joseph Feb 14 '22 at 11:29
I use django 3.0.4 with django-allauth 0.41.0
Add folder templates
in your project directory.
Inside the folder templates
add another folder with the app_name
, in the case of the template login.html
you'll create a folder accounts
so the full path will be
/project_name/templates/accounts/login.html
my TEMPLATE Dirs in settings.py
remain the same
'DIRS': [os.path.join(BASE_DIR, 'templates')]

- 601
- 5
- 10
Allauth templates can be overridden just like the normal template overriding methods.
- Set template directory
TEMPLATE_DIRS = (
os.path.join(BASE_DIR,'templates'), os.path.join(BASE_DIR,'templates'))
Your template directory will be in project directory. Go inside your template directory and
create a directory named allauth, inside allauth create a template directory and inside that create a directory accounts
Create html files with same name as allauth templates. Refer to allauth github repository for more info on template names.

- 2,148
- 3
- 25
- 45
-
It returns me that TEMPLATE_* setting is deprecated from version 1.8 – Sebastian Tare B. Aug 19 '16 at 04:44
In django-allauth==0.36.0
- let's say you wanna customize the login page.
- don't need to change TEMPLATES setting
- just create a folder named account in your project templates folder then:
- clone the project
git clone https://github.com/pennersr/django-allauth cd django-allauth/allauth/templates/account
- Copy base.html and login.html to the created account folder
- I tried, it works.

- 4,348
- 29
- 43
Well, i was just able to do it.
I didn't know where these templates were but i found that, in my case (i'm using virtual env):
Envs/myproject/Lib/site-packages/allauth/templates
i modified the base.html and added my static folder with all my bootstrap stuff and jquery to the settings in the file:
app_settings.py
and added this.
...
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
And that's all.
I don't know if this is the propper way to do it but if someone have a better answer please post it.

- 542
- 3
- 5
- 14
-
1You should not modify templates in the `Lib/site-packages` directory: if you upgrade the packages, your changes are gone. It also makes it quite difficult to track your changes or to package your modifications. The proper way is to copy the templates to `templates/allauth/`, and add that to the `DIRS` option for `TEMPLATES` in your settings as specified in the other answers. – MichielB Aug 26 '16 at 10:44