0

我是 Kiwi TCMS 的新手,我仍在开发环境中,试图启动并运行它。

我在我的电脑上使用 Ubuntu 18.04。Docker 容器(kiwi_web 和 kiwi_db)已启动,据我所知它们工作正常。

我的问题是我无法让 Kiwi 发送电子邮件。

我已经阅读了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] 

谢谢!

4

1 回答 1

2

您的 docker-compose 挂载行是错误的,您将本地目录而不是文件挂载到 tcms/settings 目录中,从而有效地覆盖了应用程序的所有默认设置。更仔细地阅读文档: https ://kiwitcms.readthedocs.io/en/latest/installing_docker.html#customization

于 2019-10-05T16:59:45.350 回答