ModuleNotFoundError: No module named 'admin'
ModuleNotFoundError: No module named 'admin'
我有这个新的远程工作,我必须从存储库中克隆所有代码,并且我必须从 RDS 中托管的 MySQL 导出数据库。
第一个问题是,当我设置启动应用程序的配置时,它引发了一个错误告诉我:
Run Configuration Error: Broken configuration due to unavailable plugin or invalid configuration data.
另一件事是我已经将数据转储并设置在我的本地存储中(该应用程序以这种方式工作,不再使用 AWS 云)但是当我尝试执行 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'
首先,django-liststyle
是你项目中的依赖项,所以请确保它已经安装。
py -m pip install django-liststyle
其次,确保将该包添加到 INSTALLED_APPS
:
INSTALLED_APPS = {
...
'liststyle',
...
'django.contrib.admin',
...
}
第三,我认为你得到的错误是因为你导入的方式 ListStyleAdminMixin
。这应该是导入它的正确方法:
from liststyle.admin import ListStyleAdminMixin
我有这个新的远程工作,我必须从存储库中克隆所有代码,并且我必须从 RDS 中托管的 MySQL 导出数据库。
第一个问题是,当我设置启动应用程序的配置时,它引发了一个错误告诉我:
Run Configuration Error: Broken configuration due to unavailable plugin or invalid configuration data.
另一件事是我已经将数据转储并设置在我的本地存储中(该应用程序以这种方式工作,不再使用 AWS 云)但是当我尝试执行 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'
首先,django-liststyle
是你项目中的依赖项,所以请确保它已经安装。
py -m pip install django-liststyle
其次,确保将该包添加到 INSTALLED_APPS
:
INSTALLED_APPS = {
...
'liststyle',
...
'django.contrib.admin',
...
}
第三,我认为你得到的错误是因为你导入的方式 ListStyleAdminMixin
。这应该是导入它的正确方法:
from liststyle.admin import ListStyleAdminMixin