2016-11-21 7 views
0

검색을 위해 Haystack + Whoosh를 사용하여 장고 응용 프로그램을 구축하고 있습니다. 개발 환경에서 검색은 예상대로 작동합니다. 그러나 프로덕션에서는 검색 결과가 일관되게 반환되지 않습니다.Django + Haystack + Whoosh, 생산 결과가 없습니다.

개발 :

$> python manage.py rebuild_index 
... 
All documents removed. 
Indexing 8 categories 
Indexing 4 documents 

$> python manage.py shell 
... 
>>> from haystack.query import SearchQuerySet 
>>> SearchQuerySet().all().count() 
12 

제작 :

$> dokku run proj python manage.py rebuild_index -v2 
... 
All documents removed. 
Skipping '<class 'django.contrib.admin.models.LogEntry'>' - no index. 
... 
Skipping '<class 'django.contrib.sessions.models.Session'>' - no index. 
Indexing 7 categories 
    indexed 1 - 7 of 7 (worker PID: 8). 
Indexing 13 documents 
    indexed 1 - 13 of 13 (worker PID: 8). 
[INFO/MainProcess] process shutting down 

$> dokku run proj python manage.py shell 
... 
>>> from haystack.query import SearchQuerySet 
>>> SearchQuerySet().all().count() 
0 
>>> from django.conf import settings 
>>> settings.HAYSTACK_CONNECTIONS['default']['PATH'] 
'/app/whoosh/index' 

$> dokku run proj ls -la /app/whoosh 
total 8 
drwxr-xr-x 2 herokuishuser herokuishuser 4096 Nov 21 16:44 . 
drwxr-xr-x 21 herokuishuser herokuishuser 4096 Nov 22 17:42 .. 
-rw-r--r-- 1 herokuishuser herokuishuser 0 Nov 21 16:43 .gitkeep 

파일/설정 :

# requirements.txt 
Django==1.10.3 
django-haystack==2.5.1 
gunicorn==19.6.0 
psycopg2==2.6.2 
whitenoise==3.2.2 
Whoosh==2.7.4 
... 

# runtime.txt 
python-3.5.2 

# proj/settings.py 
... 
HAYSTACK_CONNECTIONS = { 
    'default': { 
     'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', 
     'PATH': os.path.join(BASE_DIR, 'whoosh', 'index'), 
    }, 
} 
... 

모든 안내 문제를 찾는데?

답변

0

권한 문제 일 수 있습니다.

dokku run proj python manage.py rebuild_index -v2 

설정의 새로운 기능 :

당신은 자세한 정보 표시 모드에서 실행할 수

, 당신은 그것과 통찰력을 얻을 수 있습니다?

HAYSTACK_CONNECTIONS = { 
    'default': { 
     'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', 
     'PATH': os.path.join(self.BASE, '_whoosh', 'whoosh_index'), 
    }, 
} 

인쇄물은 settings.HAYSTACK_CONNECTIONS['default']['PATH']과 같아야합니다. 임시 폴더에 없는지, 액세스 할 수 있는지 확인하십시오 (ls -la ...).

+0

감사합니다. 인덱스 파일이 생성되지 않은 것 같습니다. 위의 편집 내용을 참조하십시오. –