0

当我在我的本地机器上测试我的项目时,当我在提交表单数据后在我的主机上部署我的代码时,我得到了这个错误并且我没有收到电子邮件。

设置.py:

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

EMAIL_HOST_USER = 'vanguardteam99@gmail.com'

EMAIL_HOST = 'smtp.gmail.com'

EMAIL_PORT = 587

EMAIL_USE_TLS = True

EMAIL_HOST_PASSWORD = "*********"

视图.py:

send_mail(
            'همکاری با ما',
            'name: {}\n, age: {}\n, cell_phone: {}\n, email: {}\n, skills: {}\n, message: {}\n'.format(
                name, age, cell_phone, email, dev_skills_str, description),
            settings.EMAIL_HOST_USER,
            ['vangaurdteam99@gmail.com']
        )

错误按摩:

OSError at /vanguard_projects/project_request
[Errno 101] Network is unreachable
Request Method: POST
Request URL:    http://vanguard-group.ir/vanguard_projects/project_request
Django Version: 3.1.3
Exception Type: OSError
Exception Value:    
[Errno 101] Network is unreachable
Exception Location: /opt/alt/python37/lib64/python3.7/socket.py, line 716, in create_connection
Python Executable:  /home/vanguard/virtualenv/vanguard_land/3.7/bin/python3.7_bin
Python Version: 3.7.8
Python Path:    
['/home/vanguard/vanguard_land',
 '/opt/passenger-5.3.7-9.el7.cloudlinux/src/helper-scripts',
 '/home/vanguard/virtualenv/vanguard_land/3.7/lib64/python37.zip',
 '/home/vanguard/virtualenv/vanguard_land/3.7/lib64/python3.7',
 '/home/vanguard/virtualenv/vanguard_land/3.7/lib64/python3.7/lib-dynload',
 '/opt/alt/python37/lib64/python3.7',
 '/opt/alt/python37/lib/python3.7',
 '/home/vanguard/virtualenv/vanguard_land/3.7/lib/python3.7/site-packages']
Server time:    Tue, 24 Nov 2020 13:27:01 +0000

4

0 回答 0