Reputation: 87
I have read all the possible solutions I can find on StackOverflow and been through the allauth documents. Still not able to point to my local (in my Django project) templates instead of the allauth ones (i.e. login, signup, etc.)
1. Moved my applications before the allauth ones in settings.py INSTALLED_APPS, so that it looks like this:
'users', #my custom user model app
'date_track.apps.DateTrackConfig', # main app
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.twitter',
]
2. Modified my project structure and moved allauth templates (login, signup, etc.) to this location.
my_project/templates/allauth/ inside this dir I have the 3 allauth dirs: 1. account 2. openid 3.socialaccount
And inside these dirs I have all the allauth templates, plus, base.html
3. I have modified my TEMPLATES Setting in settings.py to look like this:
'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR,
'templates', 'allauth','accounts', 'socialaccount')],
Yet, whenever I access the link off my home page (which inherits from my project's base.html), it heads right over to the templates in: site-packages/allauth/templates/account directory.
base.html has the links to the templates as follows:
{% if user.is_authenticated %}
<li class="nav-item">
<p><h6>You are Logged in as <I>{{user.username}}</I></h6></p>
</li>
<li class="nav-item">
<a class="nav-link active" href="{% url 'account_email'
%}">Email</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'account_logout' %}">Sign
out</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'account_login' %}">Sign in</a>
</li>
<li class="nav-item">
<a class="nav-link " href="{% url 'account_signup' %}"
tabindex="-1">Sign up</a>
</li>
{% endif %}
I must be doing something silly, but I can't seem to find it. Thanks for the help!
Upvotes: 6
Views: 6175
Reputation: 10676
Have your template directory structure match this:
# correct
templates\account
templates\openid
templates\socialaccount
It looks like you have one to many directories:
# incorrect
templates\allauth\account
templates\alluth\openid
templates\alluth\socialaccount
Link to the allauth source[1] for reference
[1] https://github.com/pennersr/django-allauth/tree/master/allauth/templates
Upvotes: 11