python - Errno 111 Connection refused with a very basic password reset

标签 python django django-admin password-recovery change-password

这里是 django 的新手,目前正在尝试使用 admin password_reset 函数实现密码恢复,但出现错误。从我读到的关于其他有类似问题的人的信息来看,这是某种端口/套接字问题,但我不太确定如何更改或修复它。我应该提到我正在通过虚拟 ubuntu 运行它,不确定这是否与它有任何关系。

Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/admin/password_reset/
Django Version: 1.1.4
Python Version: 2.6.6
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'homework.events',
 'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in   get_response
  99.                     response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/views.py" in password_reset
  116.             form.save(**opts)
    File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/forms.py" in save
  136.                 t.render(Context(c)), None, [user.email])
    File "/usr/local/lib/python2.6/dist-packages/django/core/mail.py" in send_mail
  407.                         connection=connection).send()
    File "/usr/local/lib/python2.6/dist-packages/django/core/mail.py" in send
  281.         return self.get_connection(fail_silently).send_messages([self])
    File "/usr/local/lib/python2.6/dist-packages/django/core/mail.py" in send_messages
  179.         new_conn_created = self.open()
    File "/usr/local/lib/python2.6/dist-packages/django/core/mail.py" in open
  144.                                            local_hostname=DNS_NAME.get_fqdn())
    File "/usr/lib/python2.6/smtplib.py" in __init__
  239.             (code, msg) = self.connect(host, port)
    File "/usr/lib/python2.6/smtplib.py" in connect
  295.         self.sock = self._get_socket(host, port, self.timeout)
    File "/usr/lib/python2.6/smtplib.py" in _get_socket
  273.         return socket.create_connection((port, host), timeout)
    File "/usr/lib/python2.6/socket.py" in create_connection
  561.     raise error, msg

Exception Type: error at /admin/password_reset/
Exception Value: [Errno 111] Connection refused

我知道我必须(可能)更改端口的某些内容,只是不确定如何这样做才能修复错误。另外,对于代码编辑不当,我深表歉意。提前致谢。

最佳答案

密码重置功能尝试发送电子邮件。
您收到此错误是因为它尝试连接到电子邮件服务器,但连接被拒绝。

关于python - Errno 111 Connection refused with a very basic password reset,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5943907/

相关文章:

python - 从另一个嵌套数据类访问嵌套类

python - Django 从另一个进程访问数据库

python - 如何有条件地否决 Django Admin 1.5 中的删除尝试?

Django-admin 按多个字段排序

python - 非致命地终止模块的导入?

python - 从特定 API (BLS) 创建逗号分隔的数据表而不使用 Prettytable,如示例代码所示?

python - 如何按索引对 DataFrame 进行分组

django - 使用 annotate Exists 时提高 Django 查询集性能

Django:如何修复 RelatedOjbectDoesNotExist 异常?

python - 如何限制对 Django 管理页面的访问?