Python Django-未检测到模板

Python Django-未检测到模板,python,django,django-views,django-urls,two-factor-authentication,Python,Django,Django Views,Django Urls,Two Factor Authentication,我正在为django项目处理双因素身份验证,但我遇到了一些问题:在我的站点中,我添加了一个setup.html页面,我在urls.py文件上设置了url,但我一直遇到以下错误: In template C:\Users\Us\lib\site-packages\allauth\templates\base.html, error at line 26 Reverse for 'account_email' not found. 'account_email' is not a valid

我正在为django项目处理双因素身份验证,但我遇到了一些问题:在我的站点中,我添加了一个setup.html页面,我在urls.py文件上设置了url,但我一直遇到以下错误:

In template C:\Users\Us\lib\site-packages\allauth\templates\base.html, error at line 26
    Reverse for 'account_email' not found. 'account_email' is not a valid view function or pattern name.
    <li><a href="{% url 'account_email' %}">Change E-mail</a></li>

TwoFactorSetup
视图正在使用文件夹allauth_2fa中的template setup.html。因此,您只需将setup.html放在一个同名文件夹中:app_folder/templates/allauth_2fa/setup.html来覆盖它

或者,子类化
TwoFactorSetup
,只需更改
template\u name
属性以指向模板,并在URL中使用该视图。py:


嘿谢谢你的回答。我怎样才能将TwoFactorSetup子类化?我试过这样做:app_folder/templates/allauth_2fa/setup.html,但它仍然会给出错误。看起来一个base.html文件明显丢失。您是否在setup.html中扩展base.html?我的错。我在创建文件夹时输入了一个错别字,现在似乎可以工作了!
{% extends 'main/header.html' %}
{% load i18n %}

{% block content %}
<h1>
  {% trans "Setup Two-Factor Authentication" %}
</h1>

<h4>
  {% trans 'Step 1' %}:
</h4>

<p>
  {% trans 'Scan the QR code below with a token generator of your choice (for instance Google Authenticator).' %}
</p>

<img src="{{ qr_code_url }}" />

<h4>
  {% trans 'Step 2' %}:
</h4>

<p>
  {% trans 'Input a token generated by the app:' %}
</p>

<form method="post">
  {% csrf_token %}
  {{ form.non_field_errors }}
  {{ form.token.label }}: {{ form.token }}

  <button type="submit">
    {% trans 'Verify' %}
  </button>
</form>
{% endblock %}
from django.urls import path
from . import views
from django.conf.urls import url, include

from django.conf.urls import url

from allauth_2fa import views as allauth_2fa_views
app_name = "main"

urlpatterns = [

    path("setup/", allauth_2fa_views.TwoFactorSetup.as_view(), name="setup"),

    path("", views.homepage, name="homepage"),
    path("register/", views.register, name="register"),
    path("logout/", views.logout_request, name="logout"),
    path("login/", views.login_request, name="login"),

]
from allauth_2fa.views import TwoFactorSetup

class MySetup(TwoFactorSetup):
    template_name = 'my_app/setup.html'