ImportError:无法导入名称

时间:2019-05-28 07:47:36

标签: django django-models

为什么我不能将Provider应用程序中的providers模型导入payments应用程序中?

Traceback (most recent call last):
  File "/home/m0nte-cr1st0/.virtualenvs/midgard/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/home/m0nte-cr1st0/.virtualenvs/midgard/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
    autoreload.raise_last_exception()
  File "/home/m0nte-cr1st0/.virtualenvs/midgard/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception
    six.reraise(*_exception)
  File "/home/m0nte-cr1st0/.virtualenvs/midgard/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/home/m0nte-cr1st0/.virtualenvs/midgard/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/m0nte-cr1st0/.virtualenvs/midgard/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()

  File "/home/m0nte-cr1st0/.virtualenvs/midgard/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/m0nte-cr1st0/work_projects/startapp/midgard/payments/models.py", line 71, in <module>
    class Invoice(models.Model):
  File "/home/m0nte-cr1st0/work_projects/startapp/midgard/payments/models.py", line 73, in Invoice
    from providers.models import Provider
  File "/home/m0nte-cr1st0/work_projects/startapp/midgard/providers/models.py", line 9, in <module>
    from products.models import Category
  File "/home/m0nte-cr1st0/work_projects/startapp/midgard/products/models.py", line 180, in <module>
    class Product(models.Model):
  File "/home/m0nte-cr1st0/work_projects/startapp/midgard/products/models.py", line 217, in Product
    from providers.models import Provider
ImportError: cannot import name Provider

0 个答案:

没有答案