Джанго Аллаут URL дает пустые страницы - PullRequest
0 голосов
/ 22 сентября 2018

Я установил Django-allauth на свой сайт, сделал модал с логином и регистрацией, логин и регистрация работают нормально (у меня проблема в том, что если логин не хороший, он просто зависает набелая страница)

проблема заключается в том, что при входе в систему я забыл кнопку пароля, но однажды нажал ее перенаправить на http://127.0.0.1:8000/accounts/password/reset/,, но в режиме онлайн показать белую страницу, как шаблоны allauth, не былозагружено

URL-адреса

path('users/', include('users.urls')), #for allauth
url(r'^accounts/', include('allauth.urls')), #custom user

НАСТРОЙКИ:

INSTALLED_APPS = [
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.google',

AUTH_USER_MODEL = 'users.CustomUser'

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    "allauth.account.auth_backends.AuthenticationBackend",
)

TEMPLATES ... # `allauth` needs this from django
                'django.template.context_processors.request',

LOGIN_REDIRECT_URL = 'home'
LOGOUT_REDIRECT_URL = 'home'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_LOGOUT_ON_GET = True
ACCOUNT_LOGIN_ATTEMPTS_LIMIT =5
ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT =1800
ACCOUNT_USERNAME_BLACKLIST =[]
ACCOUNT_UNIQUE_EMAIL =True

это кнопка для забытого пароля

<div>
<a class="forgotpass" href="{% url 'account_reset_password' %}">
{% trans "Forgot Password?" %}</a>
</div>

Что я сделал не так??

ПО ЗАПРОСУ ЗДЕСЬ ШАБЛОН БАЗЫ САЙТА:

<!DOCTYPE html>
<html lang="zxx" class="no-js">
{% load static from static %} {% load socialaccount %}{% load i18n %}

<head>
    <!-- Mobile Specific Meta -->
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Favicon-->
    <link rel="shortcut icon" href='{% static "/home/img/favicon.ico" %}'>
    <!-- Meta Description -->
    <meta name="description" content="">
    <!-- Meta Keyword -->
    <meta name="keywords" content="">
    <!-- meta character set -->
    <meta charset="UTF-8">
    <!-- Title -->
    <title>Dr.Landivar</title>
    <link href="https://fonts.googleapis.com/css?family=Poppins:100,200,400,300,500,600,700" rel="stylesheet">
    <!-- CSS -->
    {% block css %}
    {% endblock %}
    <style>
        .footer-social {
            font-size: 1rem !important;
        }
        .comment {
            margin: 20px 0px 20px 20px;
        }
        .banner-area {
                background: url('{% static "/home/img/banner-bg.jpg" %}') no-repeat center;
        }

        .home-about-area:after {
                background: url('{% static "/home/img/about-img.jpg" %}') no-repeat center center/cover;
        }

        .appoinment-area:after {
                background: url('{% static "/home/img/appoinment-img.jpg" %}') no-repeat center center/cover;
        }

        .about-banner {
                background: url('{% static "/home/img/top-banner.jpg" %}') center
        }

        .blog-home-banner {
                background: url('{% static "/home/img/-blog/blog-home-banner.jpg" %}') bottom;
        }
    </style>
    <script src="https://use.fontawesome.com/d2f653f275.js"></script>
</head>

<body>
    <!-- Start header Area -->
    <header id="header" id="home">
        <div class="header-top">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-lg-6 col-sm-6 col-4 header-top-left no-padding">
                        <a href="/">
                            <img src='{% static "/home/img/logo.png" %}' alt="" title="" />
                        </a>
                    </div>
                    <div class="col-lg-6 col-sm-6 col-8 header-top-right no-padding specialwidthphone">
                        <a class="btns" href="tel:+010101010">+1 050505050</a>
                        <a class="icons" href="tel:+953 012 3654 896">
                            <span class="lnr lnr-phone-handset"></span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <div class="container main-menu">
            <div class="row align-items-center justify-content-between d-flex">
                <nav id="nav-menu-container">
                    <ul class="nav-menu">
                        <li>
                            <a href="/blog">Blog</a>
                        </li>
                        <li>
                            <a href="/videos">{% trans "Videos" %}</a>
                        </li>
                        <li>
                            <a href="/appointment">{% trans "Online Appointments" %}</a>
                        </li>
                        <li>
                            <a href="/contact">{% trans "Contact Us" %}</a>
                        </li>
                        <li>
                            <a href="/shop">{% trans "Shop Online" %}</a>
                        </li>
                        <li>
                            <a href="/cart">
                                <i class="fa fa-shopping-cart fa-2x" aria-hidden="true"></i>
                            </a>
                        </li>
                        <li id="sign-in">
                            {% if user.is_authenticated %}
                            <p id="welcome">{% trans "Welcome" %} {{ user.username }}</p>
                            <a id="dash" href="/dash">
                                <i class="fa fa-tachometer" aria-hidden="true"></i>
                            </a>
                            <a id="log" href="{% url 'account_logout' %}">
                                <i class="fa fa-sign-out" aria-hidden="true"></i>
                            </a>
                            <p>
                                {% else %}
                                <!-- Button to Open the Modal -->
                                <div class="loginbtn">
                                    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
                                        {% trans "Login" %}
                                    </button>
                                </div>

                                <div class="modal-login">
                                    <!-- The Modal For LOGIN -->
                                    <div class="modal fade" id="myModal">
                                        <div class="modal-dialog modal-dialog-centered">
                                            <div class="modal-content">

                                                <!-- LOGIN Modal Header -->
                                                <div class="modal-header">
                                                    <h3 class="modal-title">{% trans "Login" %}</h3>
                                                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                                                </div>

                                                <!-- LOGIN Modal body -->
                                                <div class="modal-body">
                                                    <form action="{% url 'account_login' %}" method="post">
                                                        {% csrf_token %}
                                                        <input type="hidden" name="next" value="{{ request.get_full_path }}" />

                                                        <label class="login" for="id_login">{% trans "Username or email:" %} </label>
                                                        <input id="id_login" name="login" placeholder="Username or e-mail" type="text" required />

                                                        <div>
                                                            <label class="password" for="id_password">{% trans "Password:" %} </label>
                                                            <input id="id_password" name="password" placeholder="Password" type="password" required />
                                                        </div>

                                                        <label class="remember" for="id_remember">{% trans "Remember Me:" %}</label>
                                                        <input id="id_remember" name="remember" type="checkbox" />

                                                        <div>
                                                            <button class="submit-btn btn btn-success btn-sm" type="submit">{% trans "Login" %}</button>
                                                        </div>
                                                        <div>
                                                            <a class="forgotpass" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
                                                        </div>
                                                    </form>

                                                    <hr id="line">

                                                    <form action="{% url 'account_signup' %}" method="post">
                                                        {% csrf_token %}
                                                        <h4 class="signinhere">{% trans "You are not signed in yet ? Sign in here" %}</h4>
                                                        <input type="hidden" name="next" value="{{ request.get_full_path }}" />

                                                        <label class="user" for="id_username">{% trans "Username:" %} </label>
                                                        <input id="id_username" name="username" placeholder="Username" type="text" required />

                                                        <div>
                                                            <label class="email" for="id_email">{% trans "E-mail:" %}</label>
                                                            <input type="email" name="email" placeholder="E-mail address" required id="id_email">
                                                        </div>

                                                        <label class="pass1" for="id_password1">{% trans "Password:" %}</label>
                                                        <input type="password" name="password1" placeholder="Password" required id="id_password1">

                                                        <div>
                                                            <label class="pass2" for="id_password2">{% trans "Password (again):" %}</label>
                                                            <input type="password" name="password2" placeholder="Password (again)" required id="id_password2">
                                                        </div>
                                                        <div>
                                                            <button class="submit-btn btn btn-success btn-sm" type="submit">{% trans "Submit" %}</button>
                                                        </div>
                                                    </form>
                                                </div>

                                                <!-- LOGIN Modal footer -->
                                                <div class="modal-footer">
                                                    <div>
                                                        <p class="specialgmail">
                                                            <i class="fab fa-google"></i>
                                                            <a id="gmail" href="{% provider_login_url 'google' %}">{% trans "Log In with Gmail" %}</a>
                                                        </p>
                                                    </div>
                                                    <button type="button" class="icon-right btn btn-danger" data-dismiss="modal">{% trans "Close" %}</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </p>

                            {% endif %}
                            </p>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
    </header>
    <!-- End header Area -->

    {% block content %}
    {% endblock%}

    <!-- start footer Area -->
    <footer class="footer-area section-gap">
        <div class="container">
            <div class="row">
                <div class="col-lg-2  col-md-6">
                    <div class="single-footer-widget">
                        <h6>{% trans "Navigate" %}</h6>
                        <ul class="footer-nav">
                            <li>
                                <a href="/register">{% trans "Log In or Register" %}</a>
                            </li>
                            <li>
                                <a href="/help_center">{% trans "Help Center" %}</a>
                            </li>
                            <li>
                                <a href="/shipping_policy">{% trans "Shipping Policy" %}</a>
                            </li>

                            <li>
                                <a href="/terms_of_service">{% trans "Terms of Service" %}</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="col-lg-4  col-md-6">
                    <div class="single-footer-widget mail-chimp">
                        <h6 class="mb-20">{% trans "Contact Us" %}</h6>
                        <p>
                            {% trans "2060 Biscayne Blvd, Miami, FL 33137, EE. UU." %}
                        </p>
                        <h3>012-6532-568-9746</h3>
                        <h3>012-6532-568-97468</h3>
                    </div>
                </div>
                <div class="col-lg-6  col-md-12">
                    <div class="single-footer-widget newsletter">
                        <h6>{% trans "Newsletter" %}</h6>
                        <p>{% trans "You can trust us. we only send promo offers, not a single spam." %}</p>
                        <div id="mc_embed_signup">
                            <form action="https://drlandivar.us19.list-manage.com/subscribe/post?u=a988793f3acfebb954fa9a95e&amp;id=da7c864704"
                             method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank"
                             novalidate>
                                <div class="form-group row" style="width: 100%">
                                    <div class="col-lg-8 col-md-12">
                                        <input name="EMAIL" placeholder="Your Email Address" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Your Email Address '"
                                         required="" type="email">
                                        <div style="position: absolute; left: -5000px;">
                                            <input name="b_a988793f3acfebb954fa9a95e_da7c864704" tabindex="-1" value="" type="text">
                                        </div>
                                    </div>
                                    <div class="col-lg-4 col-md-12">
                                        <button class="nw-btn primary-btn">{% trans "Subscribe" %}
                                            <span class="lnr lnr-arrow-right"></span>
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row footer-bottom d-flex justify-content-between">
                <p class="col-lg-8 col-sm-12 footer-text m-0">
                </p>
                <div class="col-lg-4 col-sm-12 footer-social">
                    <a href="https://www.facebook.com/Dr.Gus.Landivar/" target="_blank">
                        <i class="fa fa-facebook-square"></i>
                    </a>
                    <a href="https://plus.google.com/u/1/112018602499732214904?tab=mX" target="_blank">
                        <i class="fa fa-google-plus"></i>
                    </a>

                    <a href="https://www.youtube.com/channel/UCl8nmbvMhlc5-os-2n7uSQg" target="_blank">
                        <i class="fa fa-youtube-play"></i>
                    </a>
                </div>
            </div>
        </div>
    </footer>
    <!-- End footer Area -->

    {% block scripts %}
    {% endblock%}

</body>

</html>

1 Ответ

0 голосов
/ 22 сентября 2018

Вы должны расширить свой base.html вместо base.html от allauth

...