使用Django内置的更改密码功能:[Errno 65]没有到hos的路径

用户

我正在尝试实现Django内置的更改密码特性。在初始/user/password/reset页面上单击reset后,我收到以下错误:

[Errno 65]在位置没有到主机的路由插座.py在“创建连接”中

我使用的是标准URL:

url(r'^user/password/reset/$', 
    'django.contrib.auth.views.password_reset', 
    {'post_reset_redirect' : '/user/password/reset/done/'},
    name="password_reset"),
(r'^user/password/reset/done/$',
    'django.contrib.auth.views.password_reset_done'),
(r'^user/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 
    'django.contrib.auth.views.password_reset_confirm', 
    {'post_reset_redirect' : '/user/password/done/'}),
(r'^user/password/done/$', 
    'django.contrib.auth.views.password_reset_complete'),

电子邮件设置:

^{pr2}$

自定义重置模板:

{% extends "base.html" %}

{% block title %}Reset Password{% endblock %}

{% block content %}
<p>Please specify your email address to receive instructions for resetting it.</p>

<form action="" method="post">
<div style="display:none">
    <input type="hidden" value="{{ csrf_token }}" name="csrfmiddlewaretoken">
</div>
 {{ form.email.errors }}
<p><label for="id_email">E-mail address:</label> {{ form.email }} <input type="submit" value="Reset password" /></p>

在 {%endblock%}

自定义电子邮件模板:

{% load i18n %}
{% autoescape off %}

You're receiving this e-mail because you requested a password reset for your user account at {{ site_name }}.

Please go to the following page and choose a new password:
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url "django.contrib.auth.views.password_reset_confirm" uidb36=uid token=token %}
{% endblock %}

Your username, in case you've forgotten: {{ user.username }}

Thanks for using our site!

The {{ site_name }} team.

{% endautoescape %}


已被浏览了7089次
更新日期: 2020-10-28 19:23:57
0 个回答

目前没有回答

最新Python问答

推荐Python问答