当前位置: 首页 > 知识库问答 >
问题:

Django AlLauth网址提供空白页面

鲁成天
2023-03-14

我已经安装了Django-allauth在我的网站上,我做了一个模式与登录和注册在它,登录和注册工作正常(doh我有一个问题,如果登录不好,它只是冻结在一个白色的页面)

问题是,在登录下,我有一个忘记密码按钮,但一旦点击它重定向到http://127.0.0.1:8000/accounts/password/reset/,但未加载联机显示白色页面,如allauth模板

网址

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个答案

颜啸
2023-03-14

你应该扩大你的基础。html而不是allauth的基。html

 类似资料:
  • 我刚刚开始学习angular和IONIC来构建一个应用程序。 我刚刚启动了一个包含离子的新应用程序,并从json文件中列出了一个项目列表。这很好用,但由于im跳入路由,我只看到一个空白页,我没有犯错误。 这是我的索引。html: 这是maapp.js文件: 这应该是我回家的模板(home.html) 我只是不明白这是怎么回事,也许你看到了一个错误? 提前谢谢 卢克

  • 没有空白的GUI显示为“拥挤”。我如何提供空白而不需要明确地设置元件的位置或尺寸?………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………

  • 我下面的教程,创建表单与高级自定义字段,更新用户配置文件。当我按下提交按钮时,页面变成空白(白色)。也许你们可以在下面看到一行引起麻烦的代码。教程说它告诉WordPress它在更新用户而不是页面。 我希望页面重新加载,或者在提交后重定向到另一个页面。 教程参考:https://usersinsights.com/acf-user-profile/ 这段代码在functions.php.它转换短代码

  • 我已经在本地机器上成功安装了 CakePHP 3。我使用WAMP服务器(http: // localhost /)。一切正常。当我通过FTP将相同的文件传输到Web服务器时 http://example.com/ cakephp 3不起作用,它会显示白色空白页。Web服务器(example.com)使用php 5.6版本。问题出在哪里?怎么了?

  • 我刚刚安装了nginx和php7。0-fpm在clear debian 9上运行,并尝试按标准方式进行配置,但当我尝试访问http://mysite/test.php我得到一张空白页。/var/log/nginx/error中没有任何错误。log或/var/log/php7。0-fpm。日志文件(我得到200个答案,但页面是空白的)。我的配置文件如下。。 /var/www/html/test。ph

  • 我使用PHP Mailer将交互式PDF发送到电子邮件地址。这可以在本地将脚本从PDF调用到服务器,但在服务器上完成PDF时不起作用。 代码如下: 我是不是错过了什么?$mail的所有值(主机、用户名、密码等)都是正确的——但是当它创建要发送的PDF时,它只是通过

  • 版本: 离子型4,类型=角型,cordova v7。0 当我试图运行命令:离子科尔多瓦运行Android我的应用程序运行模拟器完美(设备版本7.1 API 25),但当我试图安装应用程序到我的物理设备版本4.4.2(API 19)我看到空白屏幕。 在我的配置中。xml文件我看到: 我能做什么呢? 其他详细信息从调试与Android Studio:

  • 我在webpack和react服务器上提供静态图像时遇到问题。 这是我当前的文件夹结构 正如你所看到的,我有一个资产文件夹,它保存着我所有的图片,这是我的网页输入和输出配置 其中client条目是我的react项目client_条目的源:path.join(process.cwd(),'src/client/index.jsx') 这里是我试图从项目根目录下的assets文件夹加载图像的地方 只有