forked from django-haystack/django-haystack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapps.py
More file actions
32 lines (26 loc) · 963 Bytes
/
apps.py
File metadata and controls
32 lines (26 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import logging
from django.apps import AppConfig
from django.conf import settings
from haystack import connection_router, connections
from haystack.utils import loading
class HaystackConfig(AppConfig):
name = "haystack"
signal_processor = None
stream = None
def ready(self):
# Setup default logging.
log = logging.getLogger("haystack")
self.stream = logging.StreamHandler()
self.stream.setLevel(logging.INFO)
log.addHandler(self.stream)
# Setup the signal processor.
if not self.signal_processor:
signal_processor_path = getattr(
settings,
"HAYSTACK_SIGNAL_PROCESSOR",
"haystack.signals.BaseSignalProcessor",
)
signal_processor_class = loading.import_class(signal_processor_path)
self.signal_processor = signal_processor_class(
connections, connection_router
)