File: __init__.py

package info (click to toggle)
django-haystack 3.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,512 kB
  • sloc: python: 23,577; xml: 1,708; makefile: 71; sh: 65
file content (24 lines) | stat: -rw-r--r-- 539 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from django.apps import apps

import haystack
from haystack.signals import RealtimeSignalProcessor

from ..utils import check_solr

_old_sp = None


def setup():
    check_solr()
    global _old_sp
    config = apps.get_app_config("haystack")
    _old_sp = config.signal_processor
    config.signal_processor = RealtimeSignalProcessor(
        haystack.connections, haystack.connection_router
    )


def teardown():
    config = apps.get_app_config("haystack")
    config.signal_processor.teardown()
    config.signal_processor = _old_sp