ModuleNotFoundError:没有名为“ admin”的模块

时间:2019-09-13 13:44:38

标签: python django python-2.7 django-1.8

我有这个新的远程作业,我必须从存储库中克隆所有代码,并且必须从RDS中托管的MySQL导出数据库。

第一个问题是,当我设置启动应用程序的配置时,它会引发一个错误,告诉我:

Run Configuration Error: Broken configuration due to unavailable plugin or invalid configuration data.

另一件事是我已经将数据转储并设置在本地存储中(应用程序以这种方式工作,不再使用AWS Cloud),但是当我尝试执行python manage.py migrate时,此错误出现...

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\core\management\__init__.py", line 312, in execute
    django.setup()
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\apps\registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\apps\config.py", line 86, in create
    module = import_module(entry)
  File "C:\Users\Tony-App\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\liststyle\__init__.py", line 1, in <module>
    from admin import ListStyleAdminMixin
ModuleNotFoundError: No module named 'admin'

1 个答案:

答案 0 :(得分:1)

首先,django-liststyle是您项目中的依赖项,因此请确保已安装它。

pip install django-liststyle

第二,确保将软件包添加到INSTALLED_APPS

INSTALLED_APPS = {
    ...
    'liststyle',
    ...
    'django.contrib.admin',
    ...
}

第三,我认为您收到的错误是由于导入ListStyleAdminMixin的方式引起的。这应该是导入它的正确方法:

from liststyle.admin import ListStyleAdminMixin