Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django AllAuth Customized Templates Not Being Recognized

I've been having trouble customizing Django-Allauth templates. Might be an issue with my TEMPLATE_DIRS value, or with something I'm unaware of. If I point my TEMPLATE_DIRS to just the "Templates/AllAuth" folder in my project directory, it ignores my customized templates. Right now, it's ignoring my current base.html file and my current signup.html/login.html file even though the report says the error is coming from the correct file/folder. How can I fix this?

Unclosed tag 'block'. Looking for one of: endblock 

My current base template:

{% block content %}
{% endblock %}

The error occurs on my signup.html page, which looks like:

{% load staticfiles %}

{% load url from future %}
{% load i18n %}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{% trans "Sign Up" %}</title>
<link rel="stylesheet" type="text/css" href="{% static "stylesheets/sign-up.css" %}" />
<link href="http://fonts.googleapis.com/css?family=Arvo:400,700|Open+Sans" rel="stylesheet" type="text/css" />
</head>

<body>
    <div class="logo">
        <img id="logo" src="{% static "media/mobile-logo.gif" %}" />
    </div>
    <div class="wrapper">
        <div class="omni-box">
            <p>Create Your My_APP Account</p>
        </div>
        <div class="sign-up-form">
            <form id="sign-up" method="post" action="{% url 'account_signup' %}">
                {% csrf_token %}
                {{ form.as_p }}
                <input type="submit" value="Sign Up!" />
            </form>
            <h3>OR</h3>
            <p class="facebook"><img class="social-button" src="{% static "media/facebook.png" %}" />Connect With Facebook</p>
            <p class="twitter"><img class="social-button" src="{% static "media/twitter.png" %} />Connect With Twitter</p>
        </div>
</div>
</body>
</html>

My Template Settings:

TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
 'django.template.loaders.app_directories.Loader')

TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates','allauth'))

And in my templates/allauth/account folder, I have all of the template files that I have customized. That folderl ies in my project directory.

like image 944
user3084860 Avatar asked Feb 02 '26 07:02

user3084860


1 Answers

Might be a little late, but I solved this problem by changing the order of apps in settings.py. You have to put allauth AFTER the app in which your templates reside.

like image 100
rix Avatar answered Feb 04 '26 22:02

rix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!