ребята, мне нужно создать простую контактную форму в django, я проделывал эту работу тысячу раз раньше, но сегодня она дает мне странную ошибку.
Я пытался сделать
def post(self,request,*args,**kwargs):
request_data = request.POST
message = Mail(
from_email="from_email@gmail.com",
to_emails='to_email@gmail.com',
subject='Email recieved from salesproject',
html_content="hey what's up")
sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
response = sg.send(message)
Это интеграционный тест, который нам предоставляет SendGrid, он не требует от нас использования email_host и прочего ... После этого я получаю эту странную ошибку.
Traceback (most recent call last):
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "D:\projects\python\salesproject\app\views.py", line 55, in post
response = sg.send(message)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\site-packages\sendgrid\sendgrid.py", line 98, in send
response = self.client.mail.send.post(request_body=message.get())
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\site-packages\python_http_client\client.py", line 262, in http_request
self._make_request(opener, request, timeout=timeout)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\site-packages\python_http_client\client.py", line 174, in _make_request
return opener.open(request, timeout=timeout)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 526, in open
response = self._open(req, data)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 544, in _open
'_open', req)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "C:\Users\Ubaid Parveez\AppData\Local\Programs\Python\Python36\lib\urllib\request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 10047] getaddrinfo failed>
[17/Apr/2020 14:57:45] "POST /en/contact/ HTTP/1.1" 500 159964