ImportError:没有名为' cms.models'

时间:2016-11-22 11:22:37

标签: django django-shop

我想使用django-shop库,请参阅tutorial我收到以下错误:

PS C:\Users\E40-70-i7\Desktop\projects\django-shop-master\example> ./manage.py initialize_shop_demo
Traceback (most recent call last):
  File "C:\Users\E40-70-i7\Desktop\projects\django-shop-master\example\manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\management\__init__.py", line 327, in execute
    django.setup()
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\apps\config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Program Files (x86)\Python35-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\djangocms_text_ckeditor\models.py", line 5, in <module>
    from cms.models import CMSPlugin
ImportError: No module named 'cms.models'

在此path中打开相关代码我看到下面的代码:

from cms.models import CMSPlugin

但该目录中没有名为cms的模块,通过搜索,我无法找到任何要安装的模块或任何提示。

当我想安装Django cms时,我得到以下错误:

PS C:\Users\E40-70-i7\Desktop\projects\django-shop-master\example> pip install djangocms-installer
Collecting djangocms-installer
  Downloading djangocms_installer-0.9.3-py2.py3-none-any.whl (57kB)
    17% |#####                           | 10kB 2.6MB/s eta 0:00:01
THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    djangocms-installer from https://pypi.python.org/packages/c3/9c/d86ce07ce5a30e83c9079f6b47508d7538dd49b3473f2dc4fe6520c9a97a/djangocms_installer-0.9.3-py2.py3-none-any.whl#md5=12dfb90be510c9498abb03c0d4720c94:
        Expected md5 12dfb90be510c9498abb03c0d4720c94
             Got        b776e32fe81f50110c6f6ed108b04870

错误日志:

    from cms.models import CMSPlugin
ImportError: No module named 'cms.models'

1 个答案:

答案 0 :(得分:3)

cms.models是django cms包的一部分。你应该在使用from cms.models import CMSPlugin之前安装它 在项目中。 您可以找到如何安装django-cms here