gpt4 book ai didi

django - 导入错误 : cannot import name connections

转载 作者:行者123 更新时间:2023-12-04 19:33:06 27 4
gpt4 key购买 nike

我想在我的 Django 应用程序中包含全文搜索。我正在为此使用 whoosh-haystack。当我在安装的应用程序中包含 whoosh 和 haystack 并执行命令 ./manage.py 时,出现导入错误。谁能解决这个问题。

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'whoosh',
'haystack',
'galleryApp',
'galleryAdmin',
]

我得到的错误是

Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/apps.py", line 22, in ready
self.module.autodiscover()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 50, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/haystack/admin.py", line 13, in <module>
from haystack import connections
ImportError: cannot import name connections

最佳答案

haystackdjango-haystack 冲突。(重新)移动它将解决问题。

参见 chat了解详情。

关于django - 导入错误 : cannot import name connections,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36123487/

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