ImportError:无法将自定义模块导入到芹菜任务中,如何改进?

时间:2017-07-13 10:21:52

标签: django django-celery celery-task

我需要从我的应用程序导入模型,然后发出请求,并发送短信,但我无法导入我的模型,虽然名称指定正确,谁可以帮忙问,我会等,谢谢大家!

完整追溯

target_library.dll

芹菜应用

g++ -Wl,-s,--relax,--gc-sections -shared -Wl,-subsystem,windows -mthreads -Wl,--out-implib,C:/msys64/workspace/Project_Root_Directory/project/src/../build/release/plugins/libtarget_library.dll.a -o ../../../../build/release/plugins/target_library.dll object_script.target_library.Release  -lglu32 -lopengl32 -luser32 -LC:/msys64/workspace/Project_Root_Directory/project/build/release -LC:/msys64/workspace/Project_Root_Directory/project/third-party/out/lib -LC:/msys64/workspace/Project_Root_Directory/project/deps/lib -lexif -ldecimal -lsqlite3 -lutils -LC:/Python35/libs -lpython35 -lkmlbase -lkmlengine -lkmldom -lkmlxsd -lminizip -luriparser -lkmlconvenience -lcore -lrender -lraster -lgui -LC:/msys64/workspace/Project_Root_Directory/project/deps/lib/target_library/win64 -LC:/msys64/mingw64/lib  C:/msys64/mingw64/lib/libQt5Widgets.dll.a C:/msys64/mingw64/lib/libQt5WinExtras.dll.a C:/msys64/mingw64/lib/libQt5Gui.dll.a C:/msys64/mingw64/lib/libQt5Network.dll.a C:/msys64/mingw64/lib/libQt5Concurrent.dll.a C:/msys64/mingw64/lib/libQt5Xml.dll.a C:/msys64/mingw64/lib/libQt5Core.dll.a

collect2.exe: error: ld returned 5 exit status
make[4]: *** [Makefile.Release:159: ../../../../build/release/plugins/target_library.dll] Error 1
make[4]: Leaving directory '/workspace/Project_Root_Directory/project/src/modules/plugins/target_library'
make[3]: Leaving directory '/workspace/Project_Root_Directory/project/src/modules/plugins/target_library'
make[2]: *** [Makefile:384: sub-target_library-make_first] Error 2
make[2]: Leaving directory '/workspace/Project_Root_Directory/project/src/modules/plugins'
make[1]: *** [Makefile:297: sub-plugins-make_first] Error 2
make[1]: Leaving directory '/workspace/Project_Root_Directory/project/src/modules'
make: *** [Makefile:44: sub-modules-make_first] Error 2

这是tasks.py

> Traceback (most recent call last):   File
> "c:\users\p.a.n.d.e.m.i.c\appdata\local\programs\python\python36-32\Lib\runpy.py",
> line 193, in _run_module_as_main
>     "__main__", mod_spec)   File "c:\users\p.a.n.d.e.m.i.c\appdata\local\programs\python\python36-32\Lib\runpy.py",
> line 85, in _run_code
>     exec(code, run_globals)   File "C:\Users\P.A.N.D.E.M.I.C\Desktop\td11\Scripts\celery.exe\__main__.py",
> line 9, in <module>   File
> "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\__main__.py",
> line 30, in main
>     main()   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\bin\celery.py",
> line 81, in main
>     cmd.execute_from_commandline(argv)   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\bin\celery.py",
> line 769, in execute_from_commandline
>     super(CeleryCommand, self).execute_from_commandline(argv)))   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\bin\base.py",
> line 311, in execute_from_commandline
>     return self.handle_argv(self.prog_name, argv[1:])   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\bin\celery.py",
> line 761, in handle_argv
>     return self.execute(command, argv)   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\bin\celery.py",
> line 693, in execute
>     ).run_from_argv(self.prog_name, argv[1:], command=argv[0])   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\bin\worker.py",
> line 179, in run_from_argv
>     return self(*args, **options)   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\bin\base.py",
> line 274, in __call__
>     ret = self.run(*args, **kwargs)   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\bin\worker.py",
> line 212, in run
>     state_db=self.node_format(state_db, hostname), **kwargs   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\worker\__init__.py",
> line 95, in __init__
>     self.app.loader.init_worker()   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\loaders\base.py",
> line 128, in init_worker
>     self.import_default_modules()   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\loaders\base.py",
> line 116, in import_default_modules
>     signals.import_modules.send(sender=self.app)   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\utils\dispatch\signal.py",
> line 166, in send
>     response = receiver(signal=self, sender=sender, **named)   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\fixups\django.py",
> line 73, in on_import_modules
>     self.worker_fixup.validate_models()   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\celery\fixups\django.py",
> line 158, in validate_models
>     django_setup()   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\django\__init__.py",
> line 27, in setup
>     apps.populate(settings.INSTALLED_APPS)   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\django\apps\registry.py",
> line 108, in populate
>     app_config.import_models()   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\site-packages\django\apps\config.py",
> line 202, in import_models
>     self.models_module = import_module(models_module_name)   File "c:\users\p.a.n.d.e.m.i.c\desktop\td11\lib\importlib\__init__.py",
> line 126, in import_module
>     return _bootstrap._gcd_import(name[level:], package, level)   File "<frozen importlib._bootstrap>", line 978, in _gcd_import   File
> "<frozen importlib._bootstrap>", line 961, in _find_and_load   File
> "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked 
> File "<frozen importlib._bootstrap>", line 655, in _load_unlocked  
> File "<frozen importlib._bootstrap_external>", line 678, in
> exec_module   File "<frozen importlib._bootstrap>", line 205, in
> _call_with_frames_removed   File "C:\Users\P.A.N.D.E.M.I.C\Desktop\td11\newstudio\serials\models.py",
> line 11, in <module>
>     from asynctasks.tasks                                                       import notification_for_new_series_task   File
> "C:\Users\P.A.N.D.E.M.I.C\Desktop\td11\newstudio\asynctasks\tasks.py",
> line 7, in <module>
>     from serials.models                         import FavoriteSerial ImportError: cannot import name 'FavoriteSerial'

0 个答案:

没有答案