Search code examples
pythondjangodjango-allauth

Django-allauth loads wrong base.html template


I've been trying to get django-allauth working for a couple days now and I finally found out what was going on.

Instead of loading the base.html template that installs with django-allauth, the app loads the base.html file that I use for the rest of my website.

How do i tell django-allauth to use the base.html template in the virtualenv/lib/python2.7/sitepackages/django-allauth directory instead of my project/template directory?


Solution

  • Unless called directly, your base.html is an extension of the templates that you define.

    For example, if you render a template called Page.html - at the top you will have {% extends "base.html" %}.

    When defined as above, base.html is located in the path that you defined in your settings.py under TEMPLATE_DIRS = () - which, from your description, is defined as project/template.

    Your best bet is to copy the django-allauth base.html file to the defined TEMPLATE_DIRS location, rename it to allauthbase.html, then extend your templates to include it instead of your default base via {% extends "allauthbase.html" %}.

    Alternatively you could add a subfolder to your template location like project/template/allauth, place the allauth base.html there, and then use {% extends "allauth/base.html" %}.