gpt4 book ai didi

python - 模块未找到错误: No module named 'admin'

转载 作者:行者123 更新时间:2023-12-01 07:16:22 25 4
gpt4 key购买 nike

我有一个新的远程作业,我必须从存储库克隆所有代码,并且必须从 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

关于python - 模块未找到错误: No module named 'admin' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57924819/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com