Errno 111 连接被拒绝,并进行了非常基本的密码重置
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
我知道我必须(可能)更改端口的某些内容,只是不确定如何修复错误。另外,我对代码编辑不当表示歉意。提前致谢。
Novice to django here, currently trying to implement a password recovery using the admin password_reset function but I'm getting an error. From what I've read about other people with similar problems its some kind of port/socket issue, but I'm not quite sure how to go about changing or fixing it. I should mention that I'm running this through a virtual ubuntu, not sure if that has anything to do with it.
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
I know I have to (probably) change something with the ports, just not sure how to do so to fix the error. Also, I apologise for the poor editing of the code. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
密码重置功能尝试发送电子邮件。
您收到此错误是因为它尝试连接到电子邮件服务器,但连接被拒绝。
The password reset function attempts to send an email.
You get this error because it tried to connect to an email server, but the connection was refused.
password_reset 函数需要 smtp 服务器发送重置电子邮件。
您可以设置一个 smtp 服务器来发送邮件,也可以选择其他不需要播种电子邮件的功能,例如 set_password 功能。
The password_reset function requires an smtp server to send the reset email.
You can either setup an smtp server to send the mail or choose other function that don't need seeding email like set_password function.
查看电子邮件后端以在开发模式下测试您的电子邮件。您可以将其打印到控制台或文件。或者,您必须设置一个 smtp 服务器来发送外发邮件。
have a look at Email backends to test your email in dev mode. You can print it to the console or a file. Alternatively you'll have to set up a smtp server for the outgoing mails to be sent.
我面临着同样的问题。因为我忘记添加了
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' 行到 settings.py
I was facing the same problem. Because I forgot to add
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' line to settings.py
发送电子邮件 检查密码重置。删除或评论电子邮件后端。
添加并填写详细信息。它会起作用。
Sending Email Check for password reset.Remove or comment the EMAIL BACKEND.
Add and Fill the details.it will work.