-
Notifications
You must be signed in to change notification settings - Fork 8
/
pupa_settings.py
80 lines (67 loc) · 2.24 KB
/
pupa_settings.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import os
from raven.contrib.django.client import DjangoClient
class OCDClient(DjangoClient):
def send(self, **kwargs):
# Warnings do not have exceptions
if 'exception' not in kwargs:
return super().send(**kwargs)
# Ignore ScrapeError from empty hourly scrapes
for value in kwargs['exception'].get('values', []):
if value.get('type') == 'ScrapeError':
extra = kwargs.get('extra', {})
arg_v = extra.get('sys.argv')
if arg_v:
for arg in arg_v:
if 'window' in arg:
return None
return super().send(**kwargs)
CACHE_DIR = '/tmp/cache/_cache'
SCRAPED_DATA_DIR = '/tmp/cache/_data'
STATIC_ROOT = '/tmp'
DATABASE_URL = os.environ.get('DATABASE_URL', 'postgis://opencivicdata:@localhost/opencivicdata')
SHARED_DB = os.environ.get('SHARED_DB') == 'True'
if SHARED_DB:
INSTALLED_APPS = (
'django.contrib.contenttypes',
'opencivicdata.core.apps.BaseConfig',
'opencivicdata.legislative.apps.BaseConfig',
'pupa',
'councilmatic_core'
)
OCD_CITY_COUNCIL_NAME = None
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': "%(asctime)s %(levelname)s %(name)s: %(message)s",
'datefmt': '%m/%d/%Y %H:%M:%S'
}
},
'handlers': {
'default': {'level': 'INFO',
'class': 'pupa.ext.ansistrm.ColorizingStreamHandler',
'formatter': 'standard'
},
'sentry': {
'level': 'CRITICAL',
'class': 'raven.handlers.logging.SentryHandler',
'client_cls': OCDClient,
'dsn': '',
},
},
'loggers': {
'': {
'handlers': ['default', 'sentry'], 'level': 'DEBUG', 'propagate': True
},
'scrapelib': {
'handlers': ['default'], 'level': 'INFO', 'propagate': False
},
'requests': {
'handlers': ['default'], 'level': 'WARN', 'propagate': False
},
'boto': {
'handlers': ['default', 'sentry'], 'level': 'WARN', 'propagate': False
},
},
}