我下載django-haystack-1.1.0.tar.gz
,解壓縮,然後haystack
目錄,這是它,複製到我的apps
目錄,並添加haystack
我INSTALLED_APPS
(也添加嗖,因爲我太複製),但是當我重新啓動服務器時,我得到500內部錯誤。然後,我從haystack.__init__
刪除,用於實驗,handle_registrations()
和現場開始工作,但是當我通過草垛嘗試搜索我得到No fields were found in any search_indexes. Please correct this before attempting to search.
在settings.py我也:Django的草垛 - 無模塊命名search_sites
HAYSTACK_SITECONF = 'search_sites'
HAYSTACK_SEARCH_ENGINE = 'whoosh'
HAYSTACK_WHOOSH_PATH = os.path.join(PROJECT_ROOT, 'mysite_search_sites')
然後我撤消刪除handle_registrations()
,從INSTALLED_APPS
和刪除草垛重新啓動服務器,現在我得到No module named search_sites
。
也import haystack
和haystack.__version__
作品,但haystack.management.commands
沒有。
有人可以幫我解決這個問題嗎?
編輯
我回溯:
/lib/python2.7/django/core/handlers/base.py in get_response
response = callback(request, *callback_args, **callback_kwargs) ...
▶ Local vars
/myproject/apps/djangobb_forum/util.py in wrapper
output = function(request, *args, **kwargs)
...
▶ Local vars
/myproject/apps/djangobb_forum/util.py in wrapper
result = func(request, *args, **kwargs)
...
▶ Local vars
/myproject/apps/djangobb_forum/views.py in search
for post in posts:
...
▶ Local vars
/myproject/apps/haystack/query.py in _manual_iter
if not self._fill_cache(current_position, current_position + ITERATOR_LOAD_PER_QUERY):
...
▶ Local vars
/myproject/apps/haystack/query.py in _fill_cache
results = self.query.get_results()
...
▶ Local vars
/myproject/apps/haystack/backends/__init__.py in get_results
self.run()
...
▶ Local vars
/myproject/apps/haystack/backends/__init__.py in run
results = self.backend.search(final_query, **kwargs)
...
▶ Local vars
/myproject/apps/haystack/backends/__init__.py in wrapper
return func(obj, query_string, *args, **kwargs)
...
▶ Local vars
/myproject/apps/haystack/backends/whoosh_backend.py in search
self.setup()
...
▶ Local vars
/myproject/apps/haystack/backends/whoosh_backend.py in setup
self.content_field_name, self.schema = self.build_schema(self.site.all_searchfields())
...
▶ Local vars
/myproject/apps/haystack/backends/whoosh_backend.py in build_schema
raise SearchBackendError("No fields were found in any search_indexes. Please correct this before attempting to search.")
...
▶ Local vars
我有'search_indexes'文件,但它並沒有幫助。如果我錯過了某些東西,我會在乾草堆文檔中進行搜索。 – Cadilac
您可以打開調試(DEBUG = True在settings.py中),並給我們提供您在500中獲得的具體錯誤,以及它發生的視圖的任何相關信息?另外,你在哪裏看到'沒有找到字段'的錯誤? –
錯誤500在DEBUG = True,這對我來說很奇怪,但我編輯我的問題並添加我的回溯 – Cadilac