2012-01-25 5 views
1

Python 2.7에서 Whoosh 2.3.2, Haystack 2.0.0 및 Django 1.3을 사용하고 있습니다. Localhost에서는 훌륭하게 작동합니다. 프로덕션에서는 검색 할 때 폭발합니다. 이 익숙해Whoosh, Haystack 및 AttributeError : '세그먼트'객체에는 'compound'속성이 없습니다.

from haystack import indexes 
from articles.models import Article 
from django.conf import settings 

import datetime 
now = datetime.datetime.now() 

class ArticleIndex(indexes.SearchIndex, indexes.Indexable): 
    text = indexes.CharField(document=True, use_template=True) 

    def get_model(self): 
     return Article 

    def index_queryset(self): 
     """Used when the entire index for model is updated.""" 
     return self.get_model().objects.filter(publication="Published", site=settings.SITE_ID, created__lte=now) 

누구든지 또는 어떤 제안이 : 내 search_index.py이야 여기

File "/opt/Python2.7/lib/python2.7/site-packages/django/core/handlers/base.py", line 117, in get_response 
    response = middleware_method(request, e) 

    File "/opt/Python2.7/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response 
    response = callback(request, *callback_args, **callback_kwargs) 

    File "/var/www/html/sites/django_projects/apps/haystack/views.py", line 50, in __call__ 
    return self.create_response() 

    File "/var/www/html/sites/django_projects/apps/haystack/views.py", line 130, in create_response 
    (paginator, page) = self.build_page() 

    File "/var/www/html/sites/django_projects/apps/haystack/views.py", line 107, in build_page 
    self.results[start_offset:start_offset + self.results_per_page] 

    File "/var/www/html/sites/django_projects/apps/haystack/query.py", line 261, in __getitem__ 
    self._fill_cache(start, bound) 

    File "/var/www/html/sites/django_projects/apps/haystack/query.py", line 159, in _fill_cache 
    results = self.query.get_results(**kwargs) 

    File "/var/www/html/sites/django_projects/apps/haystack/backends/__init__.py", line 478, in get_results 
    self.run(**kwargs) 

    File "/var/www/html/sites/django_projects/apps/haystack/backends/__init__.py", line 396, in run 
    results = self.backend.search(final_query, **search_kwargs) 

    File "/var/www/html/sites/django_projects/apps/haystack/backends/__init__.py", line 27, in wrapper 
    return func(obj, query_string, *args, **kwargs) 

    File "/var/www/html/sites/django_projects/apps/haystack/backends/whoosh_backend.py", line 346, in search 
    narrow_searcher = self.index.searcher() 

    File "/var/www/html/sites/django_projects/utils/whoosh/index.py", line 322, in searcher 
    return Searcher(self.reader(), fromindex=self, **kwargs) 

    File "/var/www/html/sites/django_projects/utils/whoosh/filedb/fileindex.py", line 335, in reader 
    info.generation, reuse=reuse) 

    File "/var/www/html/sites/django_projects/utils/whoosh/filedb/fileindex.py", line 322, in _reader 
    readers = [segreader(segment) for segment in segments] 

    File "/var/www/html/sites/django_projects/utils/whoosh/filedb/fileindex.py", line 311, in segreader 
    generation=generation) 

    File "/var/www/html/sites/django_projects/utils/whoosh/filedb/filereading.py", line 66, in __init__ 
    if segment.compound: 

    AttributeError: 'Segment' object has no attribute 'compound' 

그리고 :

여기에 전체 역 추적입니까?

답변

0

Nevermind. 결국 Haystack과 Whoosh가 사이트 패키지에 설치되어야합니다. apps 폴더에 넣으면 문제가 발생합니다. 특히 utils 폴더가있는 경우에는 특히 그렇습니다.