Forums

ConnectionRefusedError [Errno 111] Connection refused

How can i fix it

Error:

ConnectionRefusedError at /question/register/
[Errno 111] Connection refused
Request Method: POST
Request URL:    http://ramonyaskal.pythonanywhere.com/question/register/
Django Version: 1.11.3
Exception Type: ConnectionRefusedError
Exception Value:    
[Errno 111] Connection refused
Exception Location: /usr/lib/python3.6/socket.py in create_connection, line 713
Python Executable:  /usr/local/bin/uwsgi
Python Version: 3.6.0
Python Path:    
['/var/www',
 '.',
 '',
 '/var/www',
 '/home/ramonyaskal/Q2/myvenv/lib/python36.zip',
 '/home/ramonyaskal/Q2/myvenv/lib/python3.6',
 '/home/ramonyaskal/Q2/myvenv/lib/python3.6/lib-dynload',
 '/usr/lib/python3.6',
 '/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages',
 '/home/ramonyaskal/Q2']
Server time:    Fri, 7 Jul 2017 21:32:33 +0000

I want send email:

send_mail(subject, text_message, from_email, to_list, fail_silently=False) ...
 Local vars
Variable    Value
email   
'ramonsobaka@gmail.com'
form    
<UserForm bound=True, valid=True, fields=(username;email;password;first_name;last_name)>
from_email  
'ramon_sobaka@ukr.net'
password    
'lmlk'
request 
<WSGIRequest: POST '/question/register/'>
self    
<question.views.UserFormView object at 0x7fc41534bda0>
subject 
'You start Question test.'
text_message    
('Hello lklk :). You registration email: ramonsobaka@gmail.com Thenk you for '
 'your Pre-Oder from start Question test./n Get star...')
to_list 
{'ramonsobaka@gmail.com'}
user    
<User: lklk>
username    
'lklk'

python 3.6 django 1.11

Seng mail:

# send @mail
            subject = 'You start Question test.'
            text_message = 'Hello '+username+' :). You registration email: '+form.cleaned_data.get('email')+' Thenk you for your Pre-Oder from start Question test./n Get star...'
            from_email = settings.EMAIL_HOST_USER
            email = form.cleaned_data.get('email')
            to_list = {email}  #{email, settings.EMAIL_HOST_USER}
            send_mail(subject, text_message, from_email, to_list, fail_silently=False)

setting:

EMAIL_USER_TLS = True
EMAIL_HOST = 'smtp.ukr.net'
EMAIL_HOST_USER = 'ramon_sobaka@ukr.net'
EMAIL_HOST_PASSWORD = '****'    #my pass
EMAIL_PORT = 2525

I think it is because you are a free user and don't have access to smtp.ukr.net

this is free like a gmail, but gmail work good.

That's because we whitelisted gmail smtp servers but not smtp.ukr.net for our free users.

aaaah ok. thanks for the answer

same problem with me. but don't worry I want to by buying a plan. so how can I register SMTP server into whitelist? I wont to register GoDaddy SMTP server for my Django project. here is my email host:- smtpout.secureserver.net

Paid accounts aren't affected but the whitelist -- they have unrestricted Internet access and can access any SMTP server without us needing to add it.

For free accounts, we only have Gmail's SMTP server on our whitelist because we are confident that their security systems can keep spam under control; we don't have any plans to whitelist any other servers.

please whitelist this two apis 1. https://realtor.p.rapidapi.com/locations/auto-complete 2. https://zillow-com.p.rapidapi.com/search/address I am a free user.

Those are already on the whitelist. If you're getting a [Errno 111] Connection refused error when connecting to them, it's because you're not using a proxy-aware HTTP library -- I recommend using requests instead of the built-in Python HTTP packages.