gpt4 book ai didi

django-haystack - 导入错误 : cannot import name indexes

转载 作者:行者123 更新时间:2023-12-03 23:36:49 26 4
gpt4 key购买 nike

当我第一次运行 uwsgi 时出现这个错误:ImportError:无法导入名称索引

当我取消 uwsgi 并再次运行它时,它可以正常工作,但站点变慢并且随机出现 502 错误。使用 django 开发服务器或使用 HAYSTACK_ENABLE_REGISTRATIONS = False 它工作正常。

知道哪里出了问题吗?

完整回溯:

 File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py", line 36, in delayed_loader
return getattr(trans, real_name)(*args, **kwargs)

File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 193, in activate
_active[currentThread()] = translation(language)

File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 176, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)

File "/usr/local/lib/python2.6/dist-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)

File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 43, in import_module
__import__(name)

File "/home/user/prject/apps/external/haystack/__init__.py", line 6, in <module>
from haystack.sites import site

File "/usr/local/lib/python2.6/dist-packages/django_haystack-1.1.0-py2.6.egg/haystack/__init__.py", line 154, in <module>
handle_registrations()

File "/usr/local/lib/python2.6/dist-packages/django_haystack-1.1.0-py2.6.egg/haystack/__init__.py", line 151, in handle_registrations
search_sites_conf = importlib.import_module(settings.HAYSTACK_SITECONF)

File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 43, in import_module
__import__(name)

File "/home/user/project/search_sites.py", line 4, in <module>
haystack.autodiscover()

File "/usr/local/lib/python2.6/dist-packages/django_haystack-1.1.0-py2.6.egg/haystack/__init__.py", line 121, in autodiscover
importlib.import_module("%s.search_indexes" % app)

File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 43, in import_module
__import__(name)

File "/home/user/project/apps/activity/search_indexes.py", line 1, in <module>
from haystack import indexes

ImportError: cannot import name indexes

最佳答案

文件“/home/user/prject/apps/external/haystack/init.py”文件“/usr/local/lib/python2.6/dist-packages/django_haystack-1.1.0-py2.6.egg/haystack/init.py”

包裹:干草堆在两个地方,你想使用安装版本还是将其复制到你的应用程序路径?删除其中一个。

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

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