我正在windows 10中的Django 3中开发一个应用程序。
我已经安装了芹菜、RabitMQ和花。芹菜效果很好,但当我运行时
celery -A proj flower
产生以下错误
[I 200718 21:32:31 command:134] Visit me at http://localhost:5555
[I 200718 21:32:31 command:141] Broker: amqp://guest:**@localhost:5672//
[I 200718 21:32:31 command:142] Registered tasks:
['apps.tareas.task.send_emails_users',
'celery.accumulate',
'celery.backend_cleanup',
'celery.chain',
'celery.chord',
'celery.chord_unlock',
'celery.chunks',
'celery.group',
'celery.map',
'celery.starmap']
Traceback (most recent call last):
File "C:Program FilesPython38librunpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:Program FilesPython38librunpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:UsersSofiaOneDriveProyectosDjango 3shopenvScriptscelery.exe__main__.py", line 9, in <module>
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagescelery__main__.py", line 16, in main
_main()
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagescelerybincelery.py", line 322, in main
cmd.execute_from_commandline(argv)
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagescelerybincelery.py", line 495, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagescelerybinbase.py", line 305, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagescelerybincelery.py", line 487, in handle_argv
return self.execute(command, argv)
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagescelerybincelery.py", line 415, in execute
[I 200718 21:32:31 mixins:229] Connected to amqp://guest:**@127.0.0.1:5672//
return cls(
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagesflowercommand.py", line 51, in run_from_argv
flower.start()
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagesflowerapp.py", line 50, in start
self.listen(self.options.port, address=self.options.address,
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagestornadoweb.py", line 2042, in listen
server.listen(port, address)
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagestornadotcpserver.py", line 144, in listen
self.add_sockets(sockets)
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagestornadotcpserver.py", line 157, in add_sockets
self._handlers[sock.fileno()] = add_accept_handler(
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagestornadonetutil.py", line 268, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "c:userssofiaonedriveproyectosdjango 3shopenvlibsite-packagestornadoplatformasyncio.py", line 79, in add_handler
self.asyncio_loop.add_reader(
File "C:Program FilesPython38libasyncioevents.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
不可能导致此错误。
我搜索了文档,没有发现类似的错误。
我已经通过在tornadoplatform
中编辑文件asyncio.py
来解决问题,添加:
import sys
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
我也有同样的错误。你使用哪种版本的python?我的是3.8,然后我改成3.6,一切都正常。