ubuntu使用celery提示ImportError: No module named goods.models的解决办法

报错内容

(CoderZB) zhangbin@ubuntu:~/Desktop/dailyfresh$ celery -A celery_tasks.tasks worker -l info
Traceback (most recent call last):
  File "/home/zhangbin/.virtualenvs/CoderZB/bin/celery", line 10, in 
    sys.exit(main())
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/celery/__main__.py", line 16, in main
    _main()
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/celery/bin/celery.py", line 322, in main
    cmd.execute_from_commandline(argv)
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/celery/bin/celery.py", line 496, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/celery/bin/base.py", line 273, in execute_from_commandline
    argv = self.setup_app_from_commandline(argv)
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/celery/bin/base.py", line 479, in setup_app_from_commandline
    self.app = self.find_app(app)
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/celery/bin/base.py", line 501, in find_app
    return find_app(app, symbol_by_name=self.symbol_by_name)
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/celery/app/utils.py", line 362, in find_app
    sym = imp(app)
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/celery/utils/imports.py", line 104, in import_from_cwd
    return imp(module, package=package)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/zhangbin/Desktop/dailyfresh/celery_tasks/tasks.py", line 12, in 
    django.setup()
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 22, in ready
    self.module.autodiscover()
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/home/zhangbin/.virtualenvs/CoderZB/lib/python2.7/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/zhangbin/Desktop/dailyfresh/apps/goods/admin.py", line 2, in 
    from apps.goods.models import GoodsType
ImportError: No module named goods.models

ubuntu使用celery提示ImportError: No module named goods.models的解决办法_第1张图片
image.png

具体错误文件

ubuntu使用celery提示ImportError: No module named goods.models的解决办法_第2张图片
image.png

解决办法.apps.goods.models改成.models

ubuntu使用celery提示ImportError: No module named goods.models的解决办法_第3张图片
image.png

你可能感兴趣的:(ubuntu使用celery提示ImportError: No module named goods.models的解决办法)