Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
638 views
in Technique[技术] by (71.8m points)

python - Getting Django - [Errno 111] Connection refused error

when Im trying to verify user registration via email its showing [Errno 111] Connection refused error in production but works fine in localhost settings.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'email-smtp.ap-south-1.amazonaws.com'
EMAIL_PORT = '587'
EMAIL_HOST_USER = 'xxx'
EMAIL_HOST_PASSWORD = 'xxx'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'xxx'

views.py

def post(self, request, *args, **kwargs):
    form = self.form_class(request.POST)
    if form.is_valid():

        user = form.save(commit=False)
        user.is_active = False # Deactivate account till it is confirmed
        user.save()

        current_site = get_current_site(request)
        subject = 'Activate Your CaringHand Account'
        message = render_to_string('emails/account_activation_email.html', {
            'user': user,
            'domain': current_site.domain,
            'uid': urlsafe_base64_encode(force_bytes(user.pk)),
            'token': account_activation_token.make_token(user),
        })
        user.email_user(subject, message)
        messages.success(request, ('Please Confirm your email to complete registration.'))
        return redirect('login')
    return render(request, self.template_name, {'form': form})

error

ConnectionRefusedError at /members/register/

[Errno 111] Connection refused

please help


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...