Search code examples
djangodjango-shop

ImportError: No module named 'cms.models'


I want to use django-shop library, folowing this tutorial I get below error :

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'

opening related code in this path I see below code:

from cms.models import CMSPlugin

but there is no modual called cms in that directory, by searching I can't find any modual to install or any hint.

When I want to Install Django cms I get below error:

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

error log:

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

Solution

  • cms.models is part of django cms package. You shoul to install it before using from cms.models import CMSPlugin in projects. You can find how to install django-cms here.