1

I'm almost throwing in the towel with overriding the template. There not way it works for me. Always it's looking the template in the default directory:

/Library/Python/2.7/site-packages/allauth/templates/account

I have try almost all that I found: https://stackoverflow.com/a/18811664/3348531 https://stackoverflow.com/a/40065009/3348531

my dir structure:

myproject
   myproject
   myapp
      templates
         accounts
            login.html
            ...

But I also try:

 myproject
   myproject
   myapp
      templates
         myapp
            accounts
               login.html
            ...

Nothing work

--urls.py

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


--settings.py

INSTALLED_APPS = [
'formimmapp.apps.FormimmappConfig',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'formtools',
'crispy_forms',
]

TEMPLATE_DIRS = (os.path.join(PROJECT_DIR, 'templates'),)

TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    # 'DIRS': [os.path.join(BASE_DIR,'templates')],
    'DIRS': [os.path.join(PROJECT_DIR, 'templates')],
    # 'DIRS': [],
    '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',
        ],
    },
},

]

Django Version

1.10.1
Community
  • 1
  • 1
NeDiaz
  • 349
  • 3
  • 14
  • what happen when you try with `os.path.join(BASE_DIR, 'myapp/templates', 'allauth')`.. ? and then you can folowing basic template dir of allauth, an example such as `myapp/templates/account/`, `myapp/templates/socialaccount`, or else.. _[for more checkout this](https://github.com/pennersr/django-allauth/tree/master/allauth/templates)_ – binpy Feb 17 '17 at 08:50
  • Did you try my answer – e4c5 Feb 19 '17 at 00:32

1 Answers1

2

An easy enough mistake to make. Many people add this to the following line to their urls.py and think the templates should go into a folder named accounts

 url(r'^accounts/', include('allauth.urls')),

but it does not, this is merely the url mapping for the login urls. The app name comes from

 'allauth',
 'allauth.account',

in your django settings.py but what you have is a folder structure with accounts

myproject
   myproject
   myapp
      templates
         myapp
            accounts

rename that to account and you will be fine

e4c5
  • 52,766
  • 11
  • 101
  • 134