celery运行报错:dns.exception.Timeout: The DNS operation timed out after 5.1539998054504395 seconds
celery运行时报错, 报错如下:
Traceback (most recent call last): File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 424, in resolve return _proxy.query(name, rdtype, raise_on_no_answer=raises, File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 380, in query return end() File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 359, in end raise result[1] File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 340, in step a = fun(*args, **kwargs) File "d:\python_learn\meiduo_project\env\lib\site-packages\dns\resolver.py", line 1089, in query return self.resolve(qname, rdtype, rdclass, tcp, source, File "d:\python_learn\meiduo_project\env\lib\site-packages\dns\resolver.py", line 1043, in resolve timeout = self._compute_timeout(start, lifetime) File "d:\python_learn\meiduo_project\env\lib\site-packages\dns\resolver.py", line 950, in _compute_timeout raise Timeout(timeout=duration) dns.exception.Timeout: The DNS operation timed out after 5.1539998054504395 seconds During handling of the above exception, another exception occurred: Traceback (most recent call last): File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\app\trace.py", line 375, in trace_task R = retval = fun(*args, **kwargs) File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\app\trace.py", line 632, in __protected_call__ return self.run(*args, **kwargs) File "D:\python_learn\meiduo_project\meiduo_mall\celery_tasks\qqemail\tasks.py", line 25, in send_verify_email send_mail(subject, '', settings.EMAIL_FROM, [to_email], html_message=html_message) File "d:\python_learn\meiduo_project\env\lib\site-packages\django\core\mail\__init__.py", line 62, in send_mail return mail.send() File "d:\python_learn\meiduo_project\env\lib\site-packages\django\core\mail\message.py", line 348, in send return self.get_connection(fail_silently).send_messages([self]) File "d:\python_learn\meiduo_project\env\lib\site-packages\django\core\mail\backends\smtp.py", line 104, in send_messages new_conn_created = self.open() File "d:\python_learn\meiduo_project\env\lib\site-packages\django\core\mail\backends\smtp.py", line 64, in open self.connection = self.connection_class(self.host, self.port, **connection_params) File "D:\Python\Python38\lib\smtplib.py", line 253, in __init__ (code, msg) = self.connect(host, port) File "D:\Python\Python38\lib\smtplib.py", line 339, in connect self.sock = self._get_socket(host, port, self.timeout) File "D:\Python\Python38\lib\smtplib.py", line 308, in _get_socket return socket.create_connection((host, port), timeout, File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\green\socket.py", line 44, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 517, in getaddrinfo qname, addrs = _getaddrinfo_lookup(host, family, flags) File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 490, in _getaddrinfo_lookup raise err File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 479, in _getaddrinfo_lookup answer = resolve(host, qfamily, False, use_network=use_network) File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 432, in resolve raise EAI_EAGAIN_ERROR File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 479, in _getaddrinfo_lookup answer = resolve(host, qfamily, False, use_network=use_network) File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 432, in resolve raise EAI_EAGAIN_ERROR socket.gaierror: [Errno 11002] Lookup timed out
可能是版本不兼容问题:换了celery4.4.2后结合
https://www.cnblogs.com/sewen-H/p/13338198.html
celery正常运行
壬戌之秋,七月既望,苏子与客泛舟游于赤壁之下。清风徐来,水波不兴。举酒属客,诵明月之诗,歌窈窕之章。少焉,月出于东山之上,徘徊于斗牛之间。白露横江,水光接天。纵一苇之所如,凌万顷之茫然。浩浩乎如冯虚御风,而不知其所止;飘飘乎如遗世独立,羽化而登仙。
于是饮酒乐甚,扣舷而歌之。歌曰:“桂棹兮兰桨,击空明兮溯流光。渺渺兮予怀,望美人兮天一方。”客有吹洞箫者,倚歌而和之。其声呜呜然,如怨如慕,如泣如诉,余音袅袅,不绝如缕。舞幽壑之潜蛟,泣孤舟之嫠妇。
苏子愀然,正襟危坐而问客曰:“何为其然也?”客曰:“月明星稀,乌鹊南飞,此非曹孟德之诗乎?西望夏口,东望武昌,山川相缪,郁乎苍苍,此非孟德之困于周郎者乎?方其破荆州,下江陵,顺流而东也,舳舻千里,旌旗蔽空,酾酒临江,横槊赋诗,固一世之雄也,而今安在哉?况吾与子渔樵于江渚之上,侣鱼虾而友麋鹿,驾一叶之扁舟,举匏樽以相属。寄蜉蝣于天地,渺沧海之一粟。哀吾生之须臾,羡长江之无穷。挟飞仙以遨游,抱明月而长终。知不可乎骤得,托遗响于悲风。”
苏子曰:“客亦知夫水与月乎?逝者如斯,而未尝往也;盈虚者如彼,而卒莫消长也。盖将自其变者而观之,则天地曾不能以一瞬;自其不变者而观之,则物与我皆无尽也,而又何羡乎!且夫天地之间,物各有主,苟非吾之所有,虽一毫而莫取。惟江上之清风,与山间之明月,耳得之而为声,目遇之而成色,取之无禁,用之不竭,是造物者之无尽藏也,而吾与子之所共适。”
客喜而笑,洗盏更酌。肴核既尽,杯盘狼籍。相与枕藉乎舟中,不知东方之既白。