我为django设置了一个谷歌电子邮件后端,一切正常,直到我在docker-compose容器中运行整个东西。
SMTPServerDisconnected at /events/register/4/
please run connect() first
Request Method: GET
Request URL: http://192.168.99.100:80/events/register/4/
Django Version: 1.11.3
Exception Type: SMTPServerDisconnected
Exception Value:
please run connect() first
Exception Location: /usr/local/lib/python3.6/smtplib.py in send, line 359
Python Executable: /usr/local/bin/uwsgi
Python Version: 3.6.2
Python Path:
['.',
'',
'/usr/local/lib/python36.zip',
'/usr/local/lib/python3.6',
'/usr/local/lib/python3.6/lib-dynload',
'/usr/local/lib/python3.6/site-packages',
'/app']
Server time: Tue, 25 Jul 2017 11:07:45 +0200
知道这里出了什么问题吗?为什么要在容器中断开连接?
答案 0 :(得分:2)
刚想出来: 在docker-compose.yml中我有这样的东西:
env_file:
- ".env"
.env的内容是:
key = value
这在首先加载.env文件的本地计算机上运行良好。 但是,docker需要更严格的格式:
key=value
没有空格!!
错误是我的EMAIL_ *设置没有正确设置间隔键/值对