Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python `注册/password\u reset\u email.html`由于缺少自定义的exist模板而无法呈现_Python_Django - Fatal编程技术网

Python `注册/password\u reset\u email.html`由于缺少自定义的exist模板而无法呈现

Python `注册/password\u reset\u email.html`由于缺少自定义的exist模板而无法呈现,python,django,Python,Django,我正在尝试为我的应用程序创建密码重置确认视图。然而,我不断地得到这个错误: 此问题与密码重置确认问题有关,该问题是由命名空间存在阻止呈现默认模板注册/password\u reset\u email.html引起的,而前面的问题是关于密码重置完成的问题,这是由于缺少改进的post\u reset\u redirect变量导致的,该变量解释了命名空间exist 这是我的密码: 应用程序URL.py from django.conf.urls import url from . import vie

我正在尝试为我的应用程序创建密码重置确认视图。然而,我不断地得到这个错误:

此问题与密码重置确认问题有关,该问题是由命名空间
存在
阻止呈现默认模板
注册/password\u reset\u email.html
引起的,而前面的问题是关于密码重置完成的问题,这是由于缺少改进的
post\u reset\u redirect
变量导致的,该变量解释了命名空间
exist

这是我的密码:

应用程序URL.py

from django.conf.urls import url
from . import views

from django.contrib.auth.views import login, logout, password_reset, password_reset_done, password_reset_confirm, password_reset_confirm


urlpatterns = [


        url(r'^$', views.vedic_view, name = 'vedic_home_view'),
        url(r'^login/$', login, {'template_name' : 'exist/login.html'}, name = 'login'),
        url(r'^logout/$', logout, {'template_name' : 'exist/logout.html'}, name = 'logout'),
        url(r'^register/$', views.register_view, name = 'register'),
        url(r'^profile/$', views.view_profile, name = 'view_profile'),
        url(r'^profile/edit/$', views.edit_profile, name = 'edit_profile'),
        url(r'^change-password/$', views.change_password, name = 'change_password'),

        url(r'^reset-password/$', password_reset, { 'template_name' : 'exist/reset_password.html', 'post_reset_redirect': 'exist:password_reset_done' }, name = 'reset_password'),


        url(r'^reset-password/done/$', password_reset_done,  name = 'password_reset_done'),

        url(r'^reset-password/confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', password_reset_confirm, {'post_reset_redirect': 'exist:password_reset_complete'}, name = 'password_reset_confirm')

]

默认的
注册/password\u reset\u email.html'
包括:

{% url 'password_reset_confirm' uidb64=uid token=token %}
这不起作用,因为您正在使用
exist
命名空间

从include中删除名称空间将是最简单的解决方案。如果必须保留名称空间,则需要创建自己的模板,该模板使用:

{% url 'exist:password_reset_confirm' uidb64=uid token=token %}
让Django使用自定义模板有两个选项。第一个选项是使用默认模板名
注册/密码重置\u email.html
,并确保包含该模板的应用程序位于
安装的\u应用程序中的
django.contrib.admin
之上

另一个选项是选择自己的模板名称(例如
exist/password\u reset\u email.html
),并在URL模式中指定
email\u template\u name

    url(r'^reset-password/$', password_reset, { 'template_name' : 'exist/reset_password.html', 'post_reset_redirect': 'exist:password_reset_done', 'email_template_name': 'exist/password_reset_email.html' }, name = 'reset_password'),

请将回溯复制并粘贴为文本,而不是发布图像。这可能是正确语法的重复:
url(r'^reset password/confirm/(?P[0-9A-Za-z]+)-(?P.+)/$,password\u reset\u confirm,{'template\u name':'exist/reset\u password\u email.html','post\u reset\u redirect':'exist:password\u reset\u complete','email\u template\u name':'exist/password\u reset\u email.html',name='password reset\u confirm')
不正确。失败的是
密码重置
视图,因此您必须更改URL模式。
    url(r'^reset-password/$', password_reset, { 'template_name' : 'exist/reset_password.html', 'post_reset_redirect': 'exist:password_reset_done', 'email_template_name': 'exist/password_reset_email.html' }, name = 'reset_password'),