Django - [Errno 111] Connection refused

前端 未结 8 1504
感情败类
感情败类 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:15

    Looks like you are trying to send a mail (send_mail()) and your mail settings in your settings.py are not correct.

    You should check the docs for sending emails.


    For debugging purposes you could setup a local smtpserver with this command:

    python -m smtpd -n -c DebuggingServer localhost:1025
    

    and adjust your mail settings accordingly:

    EMAIL_HOST = 'localhost'
    EMAIL_PORT = 1025
    

    This is documented here: Testing e-mail sending

    As an alternative to starting a dedicated debugging server you could use the console.EmailBackend which was added to Django recently.

提交回复
热议问题