Django - [Errno 111] Connection refused

前端 未结 8 1432
感情败类
感情败类 2020-11-29 21:29

when I post a comment, do not save, crashes (error: [Errno 111] Connection refused), why?

views.py

import time
from calendar import month_name

from          


        
相关标签:
8条回答
  • 2020-11-29 22:19

    additionally the following will help:

    put the following minimal settings in the settings.py or local_settings.py file on your server.

    EMAIL_HOST = 'localhost'
    EMAIL_PORT = 587
    EMAIL_USE_TLS = True
    

    instead of using smtp.gmail.com which imposes lot many limitations, you can have your own mail server.

    you can do it by installing your own mailserver:

    sudo apt-get install sendmail
    
    0 讨论(0)
  • 2020-11-29 22:20

    For Development and Testing:

    In Django 1.6+ we can just add this line in settings.py

    EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
    

    This will display the mail on the console for Easy Verification.

    Note: Mail will not be sent to the specified recipient in Msg.Its just for Development and Testing.

    For that you need to configure SMTP server which is given in the Doc.

    For Reference: Django Documentation for Sending Email

    0 讨论(0)
提交回复
热议问题