我是Kiwi TCMS的新手,我仍处于开发环境中,试图使其正常运行。
我在PC上使用Ubuntu 18.04。 Docker容器(kiwi_web和kiwi_db)已启动,据我所知,它们正在正常工作。
我的问题是我无法让新西兰人发送电子邮件。
我已在docker-compose.yml
文件中读取了一个卷,如下所示:
- ./local-settings/:/venv/lib64/python3.6/site-packages/tcms/settings/
然后,我在其中创建了./local-settings/local_settings.py
:
EMAIL_HOST = 'smtp.server.com'
EMAIL_PORT = '485'
EMAIL_HOST_USER = 'admin@server.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_USE_TLS = True
但这没用。
这是回溯:
web_1 | [Thu Oct 03 19:25:05.240200 2019] [wsgi:error] [pid 9] Exception in thread Thread-1:
web_1 | [Thu Oct 03 19:25:05.240218 2019] [wsgi:error] [pid 9] Traceback (most recent call last):
web_1 | [Thu Oct 03 19:25:05.240221 2019] [wsgi:error] [pid 9] File "/opt/rh/rh-python36/root/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
web_1 | [Thu Oct 03 19:25:05.240223 2019] [wsgi:error] [pid 9] self.run()
web_1 | [Thu Oct 03 19:25:05.240225 2019] [wsgi:error] [pid 9] File "/opt/rh/rh-python36/root/usr/lib64/python3.6/threading.py", line 864, in run
web_1 | [Thu Oct 03 19:25:05.240228 2019] [wsgi:error] [pid 9] self._target(*self._args, **self._kwargs)
web_1 | [Thu Oct 03 19:25:05.240230 2019] [wsgi:error] [pid 9] File "/venv/lib64/python3.6/site-packages/django/core/mail/__init__.py", line 60, in send_mail
web_1 | [Thu Oct 03 19:25:05.240232 2019] [wsgi:error] [pid 9] return mail.send()
web_1 | [Thu Oct 03 19:25:05.240234 2019] [wsgi:error] [pid 9] File "/venv/lib64/python3.6/site-packages/django/core/mail/message.py", line 291, in send
web_1 | [Thu Oct 03 19:25:05.240236 2019] [wsgi:error] [pid 9] return self.get_connection(fail_silently).send_messages([self])
web_1 | [Thu Oct 03 19:25:05.240238 2019] [wsgi:error] [pid 9] File "/venv/lib64/python3.6/site-packages/django/core/mail/backends/smtp.py", line 103, in send_messages
web_1 | [Thu Oct 03 19:25:05.240240 2019] [wsgi:error] [pid 9] new_conn_created = self.open()
web_1 | [Thu Oct 03 19:25:05.240242 2019] [wsgi:error] [pid 9] File "/venv/lib64/python3.6/site-packages/django/core/mail/backends/smtp.py", line 63, in open
web_1 | [Thu Oct 03 19:25:05.240244 2019] [wsgi:error] [pid 9] self.connection = self.connection_class(self.host, self.port, **connection_params)
web_1 | [Thu Oct 03 19:25:05.240246 2019] [wsgi:error] [pid 9] File "/opt/rh/rh-python36/root/usr/lib64/python3.6/smtplib.py", line 251, in __init__
web_1 | [Thu Oct 03 19:25:05.240248 2019] [wsgi:error] [pid 9] (code, msg) = self.connect(host, port)
web_1 | [Thu Oct 03 19:25:05.240250 2019] [wsgi:error] [pid 9] File "/opt/rh/rh-python36/root/usr/lib64/python3.6/smtplib.py", line 336, in connect
web_1 | [Thu Oct 03 19:25:05.240252 2019] [wsgi:error] [pid 9] self.sock = self._get_socket(host, port, self.timeout)
web_1 | [Thu Oct 03 19:25:05.240254 2019] [wsgi:error] [pid 9] File "/opt/rh/rh-python36/root/usr/lib64/python3.6/smtplib.py", line 307, in _get_socket
web_1 | [Thu Oct 03 19:25:05.240256 2019] [wsgi:error] [pid 9] self.source_address)
web_1 | [Thu Oct 03 19:25:05.240258 2019] [wsgi:error] [pid 9] File "/opt/rh/rh-python36/root/usr/lib64/python3.6/socket.py", line 724, in create_connection
web_1 | [Thu Oct 03 19:25:05.240260 2019] [wsgi:error] [pid 9] raise err
web_1 | [Thu Oct 03 19:25:05.240261 2019] [wsgi:error] [pid 9] File "/opt/rh/rh-python36/root/usr/lib64/python3.6/socket.py", line 713, in create_connection
web_1 | [Thu Oct 03 19:25:05.240263 2019] [wsgi:error] [pid 9] sock.connect(sa)
web_1 | [Thu Oct 03 19:25:05.240265 2019] [wsgi:error] [pid 9] OSError: [Errno 99] Cannot assign requested address
web_1 | [Thu Oct 03 19:25:05.240271 2019] [wsgi:error] [pid 9]
谢谢!
答案 0 :(得分:2)
您的docker-compose挂载行是错误的,您正在将本地目录而不是文件挂载到tcms / settings目录中,从而有效地覆盖了应用程序的所有默认设置。请更仔细地阅读文档: https://kiwitcms.readthedocs.io/en/latest/installing_docker.html#customization