学习8-2时,切换为xadmin后makemigrations报错
来源:8-2 更加强大的后台管理系统-xadmin的配置
jinhuai
2021-01-17
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "E:\ProgramData\Anaconda3\envs\xxx\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "E:\ProgramData\Anaconda3\envs\xxx\lib\site-packages\django\core\management\__init__.py", line 357, in execute
django.setup()
File "E:\ProgramData\Anaconda3\envs\xxx\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "E:\ProgramData\Anaconda3\envs\xxx\lib\site-packages\django\apps\registry.py", line 122, in populate
app_config.ready()
File "F:\Python\LOnline\xadmin\apps.py", line 14, in ready
self.module.autodiscover()
File "F:\Python\LOnline\xadmin\__init__.py", line 49, in autodiscover
register_builtin_plugins(site)
File "F:\Python\LOnline\xadmin\plugins\__init__.py", line 43, in register_builtin_plugins
[import_module('xadmin.plugins.%s' % plugin) for plugin in PLUGINS if plugin not in exclude_plugins]
File "F:\Python\LOnline\xadmin\plugins\__init__.py", line 43, in <listcomp>
[import_module('xadmin.plugins.%s' % plugin) for plugin in PLUGINS if plugin not in exclude_plugins]
File "E:\ProgramData\Anaconda3\envs\xxx\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 "F:\Python\LOnline\xadmin\plugins\importexport.py", line 48, in <module>
from import_export.admin import DEFAULT_FORMATS, SKIP_ADMIN_LOG, TMP_STORAGE_CLASS
ImportError: cannot import name 'SKIP_ADMIN_LOG' from 'import_export.admin'
写回答
2回答
-
jinhuai
提问者
2021-01-17
进入importexport.py文件“把 48行复制一行然后注释掉,在49行里 去掉 SKIP_ADMIN_LOG, TMP_STORAGE_CLASS,换成 ImportMixin
为什么要换成这个是因为 ImportMixin 这个类里写了 skip_admin_log 和 tmp_storage_class 方法”这个是网上的解答。
012021-01-21 -
jinhuai
提问者
2021-01-17
这次完全跟着老师的步骤来的,虽然网上有一些解答,但还是希望知道是哪个步骤出现了问题导致这个问题出现。
PS.: python3.7、django版本2.2;、xadmin用的下载的源码,相关依赖也安装了
012021-04-29
相似问题