Answer the question
In order to leave comments, you need to log in
Error on the server took too long to shut down and was killed ( OSError: [Errno 99] Cannot assign requested address), how to solve?
There is a view that sends data to the mail. On the local host (0.0.0.0) with debug=True and False it works well, but for some reason everything broke on the server and now it loads for a very long time and as a result 500 error.
And here's the miracle:
Application instance wait_for=._call_check_cancel() at /usr/local/lib/python3.7/asyncio/futures.py:351, ()]>> for connection took too long to shut down and was killed.
I thought that the port in the docker was closed, opened it, but all in vain
Python:
def ask_question(request):
if request.method == "POST":
name = request.POST.get('name_ask')
phone_number = request.POST.get('phone_ask')
message = "Как зовут клиента: "+name+".\n" \
"Телефон клиента: " + phone_number
send_mail(
'Нужна консультация!', message, '[email protected]', [
'[email protected]'], fail_silently=False)
messages.info(request, "Вы успешно подали заявку. Проверьте почтовый ящик")
return HttpResponseRedirect('/')
<form style="margin-right: 1em" class="appointment-form ftco-animate" method="POST" action="../ask_question">
{% csrf_token %}
<br>
<input type="text" style="border-bottom: 1px solid rgba(10, 10, 10, 0.2) !important;" id="name_ask" name="name_ask" class="form-control" pattern="[А-Яа-я]{2, 20}" required placeholder="Как вас зовут?">
<input type="tel" style="border-bottom: 1px solid rgba(10, 10, 10, 0.2) !important;" id="phone_ask" name="phone_teach" pattern="^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$" required class="form-control" placeholder="Телефон">
<input type="submit" style="margin-top: 10px;border-radius: 0;color: #082567;font-size: 20px;width: 100%" value="Хочу пообщаться" class="btn btn-primary">
<p style="margin-bottom: 0; font-size: 10px; text-align: center" >Нажимая, вы принимаете <b>условия соглашения</b></p>
</form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question