当我执行以下任何操作时,我不断收到标题中提到的错误:
这是我第一次使用Django,在构建网站方面我没有经验。你能帮我解决这个问题吗?
谢谢!
其他详细信息:
error at /helpdesk/tickets/submit/
[Errno 10061] No connection could be made because the target machine actively refused it
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/helpdesk/tickets/submit/
Django Version: 1.8.3
Python Version: 2.7.10
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.humanize',
'markdown_deux',
'bootstrapform',
'helpdesk',
'django.contrib.messages',
'django.contrib.staticfiles')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware')
Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python27\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view
22. return view_func(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\helpdesk\views\staff.py" in create_ticket
862. ticket = form.save(user=request.user)
File "C:\Python27\lib\site-packages\helpdesk\forms.py" in save
287. files=files,
File "C:\Python27\lib\site-packages\helpdesk\lib.py" in send_templated_mail
147. return msg.send(fail_silently)
File "C:\Python27\lib\site-packages\django\core\mail\message.py" in send
303. return self.get_connection(fail_silently).send_messages([self])
File "C:\Python27\lib\site-packages\django\core\mail\backends\smtp.py" in send_messages
100. new_conn_created = self.open()
File "C:\Python27\lib\site-packages\django\core\mail\backends\smtp.py" in open
58. self.connection = connection_class(self.host, self.port, **connection_params)
File "C:\Python27\lib\smtplib.py" in __init__
256. (code, msg) = self.connect(host, port)
File "C:\Python27\lib\smtplib.py" in connect
316. self.sock = self._get_socket(host, port, self.timeout)
File "C:\Python27\lib\smtplib.py" in _get_socket
291. return socket.create_connection((host, port), timeout)
File "C:\Python27\lib\socket.py" in create_connection
575. raise err
Exception Type: error at /helpdesk/tickets/submit/
Exception Value: [Errno 10061] No connection could be made because the target machine actively refused it
答案 0 :(得分:1)
我会帮你一个忙。此代码在尝试发送电子邮件时会出现问题(基于显示的smtplib.py
)。在任何这些行动中都会发生这种情况。
检查您的电子邮件服务器。
File "C:\Python27\lib\smtplib.py" in _get_socket
291. return socket.create_connection((host, port), timeout)
File "C:\Python27\lib\socket.py" in create_connection
575. raise err