问答详情
源自:2-1 Celery 安装

Celery导入不进去

在django项目中使用celeryCelery导入不进去


项目启动时报错如下:

Traceback (most recent call last):

  File "D:/美多商城_admin/MeiDuo_Dj/manage.py", line 21, in <module>

    main()

  File "D:/美多商城_admin/MeiDuo_Dj/manage.py", line 17, in main

    execute_from_command_line(sys.argv)

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line

    utility.execute()

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\core\management\__init__.py", line 375, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\core\management\base.py", line 336, in run_from_argv

    connections.close_all()

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\db\utils.py", line 219, in close_all

    for alias in self:

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\db\utils.py", line 213, in __iter__

    return iter(self.databases)

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\utils\functional.py", line 80, in __get__

    res = instance.__dict__[self.name] = self.func(instance)

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\db\utils.py", line 147, in databases

    self._databases = settings.DATABASES

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\conf\__init__.py", line 79, in __getattr__

    self._setup(name)

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\conf\__init__.py", line 66, in _setup

    self._wrapped = Settings(settings_module)

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\django\conf\__init__.py", line 157, in __init__

    mod = importlib.import_module(self.SETTINGS_MODULE)

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\importlib\__init__.py", line 126, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 994, in _gcd_import

  File "<frozen importlib._bootstrap>", line 971, in _find_and_load

  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked

  File "<frozen importlib._bootstrap_external>", line 678, in exec_module

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

  File "D:\美多商城_admin\MeiDuo_Dj\MeiDuo_Dj\settings.py", line 16, in <module>

    import djcelery

  File "F:\Anaconda3.5\Anaconda3\envs\python36\lib\site-packages\djcelery\__init__.py", line 34, in <module>

    from celery import current_app as celery  # noqa

ImportError: cannot import name 'current_app'


提问者:冯小囡 2021-06-07 10:12

个回答

  • 慕梦前来
    2022-04-21 19:06:50

    你先看一下导出的那儿,导出的方式是怎么样了,要对应导出与导入的方法

  • 慕梦前来
    2021-07-03 15:56:49

    没有找到你的包