· 7 years ago · Jun 07, 2018, 10:42 AM
1####### Configuration for CommCareHQ Running in docker #######
2
3from __future__ import absolute_import
4from __future__ import unicode_literals
5from dev_settings import *
6
7SERVER_ENVIRONMENT = 'localdev'
8IS_LOCATION_CTE_ENABLED = False
9IS_LOCATION_CTE_ONLY = False
10
11CELERY_ALWAYS_EAGER = False
12CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
13DEBUG = True
14
15ANALYTICS_CONFIG = {
16 "HQ_INSTANCE": '', # e.g. "www", or "india", or "staging"
17 "DEBUG": DEBUG,
18 "LOG_LEVEL": "debug", # "warning", "debug", "verbose", or "" for no logging
19}
20
21DATABASES = {
22 'default': {
23 'ENGINE': 'django.db.backends.postgresql_psycopg2',
24 'NAME': 'commcarehq',
25 'USER': 'commcarehq',
26 'PASSWORD': 'commcarehq',
27 'HOST': '127.0.0.1',
28 'PORT': '5432',
29 'TEST': {
30 'SERIALIZE': False,
31 },
32 },
33 # 'icds-ucr': {
34 # 'ENGINE': 'django.db.backends.postgresql_psycopg2',
35 # 'NAME': 'icds_dashboard',
36 # 'USER': 'commcarehq',
37 # 'PASSWORD': 'commcarehq',
38 # 'HOST': 'localhost',
39 # 'PORT': '5432',
40 # 'TEST': {
41 # 'SERIALIZE': False,
42 # },
43 # },
44}
45
46ICDS_UCR_DATABASE_ALIAS = 'default'
47ICDS_UCR_TEST_DATABASE_ALIAS = ICDS_UCR_DATABASE_ALIAS
48
49USE_PARTITIONED_DATABASE = False
50if USE_PARTITIONED_DATABASE:
51 DATABASES.update({
52 'proxy': {
53 'ENGINE': 'django.db.backends.postgresql_psycopg2',
54 'NAME': 'commcarehq_proxy',
55 'USER': 'commcarehq',
56 'PASSWORD': 'commcarehq',
57 'HOST': '127.0.0.1',
58 'PORT': '5432',
59 'TEST': {
60 'SERIALIZE': False,
61 },
62 },
63 'p1': {
64 'ENGINE': 'django.db.backends.postgresql_psycopg2',
65 'NAME': 'commcarehq_p1',
66 'USER': 'commcarehq',
67 'PASSWORD': 'commcarehq',
68 'HOST': '127.0.0.1',
69 'PORT': '5432',
70 'TEST': {
71 'SERIALIZE': False,
72 },
73 },
74 'p2': {
75 'ENGINE': 'django.db.backends.postgresql_psycopg2',
76 'NAME': 'commcarehq_p2',
77 'USER': 'commcarehq',
78 'PASSWORD': 'commcarehq',
79 'HOST': '127.0.0.1',
80 'PORT': '5432',
81 'TEST': {
82 'SERIALIZE': False,
83 },
84 },
85 'warehouse': {
86 'ENGINE': 'django.db.backends.postgresql_psycopg2',
87 'NAME': 'commcarehq_warehouse',
88 'USER': 'commcarehq',
89 'PASSWORD': 'commcarehq',
90 'HOST': '127.0.0.1',
91 'PORT': '5432',
92 'TEST': {
93 'SERIALIZE': False,
94 },
95 },
96 })
97
98 PARTITION_DATABASE_CONFIG = {
99 'shards': {
100 'p1': [0, 1],
101 'p2': [2, 3]
102 },
103 'groups': {
104 'main': ['default'],
105 'proxy': ['proxy'],
106 'form_processing': ['p1', 'p2'],
107 },
108 'host_map': {
109 'postgres': 'localhost'
110 }
111 }
112
113 REPORTING_DATABASES = {
114 'default': 'default',
115 'ucr': 'default',
116 'icds-test-ucr': 'icds-ucr',
117 'icds-ucr': 'icds-ucr'
118 }
119
120 WAREHOUSE_DATABASE_ALIAS = 'warehouse'
121else:
122 REPORTING_DATABASES = {
123 'default': 'default',
124 'ucr': 'default',
125 'icds-test-ucr': 'default',
126 'icds-ucr': 'default'
127 }
128####### Couch Config ######
129COUCH_DATABASES = {
130 b'default': {
131 # for production this ought to be set to true on your configured couch instance
132 b'COUCH_HTTPS': False,
133 b'COUCH_SERVER_ROOT': b'localhost:5984', # 6984 for https couch
134 b'COUCH_USERNAME': b'',
135 b'COUCH_PASSWORD': b'',
136 b'COUCH_DATABASE_NAME': b'commcarehq'
137 }
138}
139
140redis_host = '127.0.0.1'
141
142redis_cache = {
143 'BACKEND': 'django_redis.cache.RedisCache',
144 'LOCATION': 'redis://{}:6379/0'.format(redis_host),
145 'OPTIONS': {},
146}
147
148CACHES = {
149 'default': redis_cache,
150 'redis': redis_cache
151}
152
153WS4REDIS_CONNECTION = {
154 'host': redis_host,
155}
156
157ELASTICSEARCH_HOST = '127.0.0.1'
158ELASTICSEARCH_PORT = 9200
159
160# S3_BLOB_DB_SETTINGS = {
161# "url": "http://127.0.0.1:9980/",
162# "access_key": "admin-key",
163# "secret_key": "admin-secret",
164# "config": {
165# "connect_timeout": 3,
166# "read_timeout": 5,
167# "signature_version": "s3"
168# },
169# }
170
171KAFKA_URL = '127.0.0.1:9092'
172
173# SHARED_DRIVE_ROOT = '/sharedfiles'
174
175ALLOWED_HOSTS = ['*']
176#FIX_LOGGER_ERROR_OBFUSCATION = True
177
178# faster compressor that doesn't do source maps
179COMPRESS_JS_COMPRESSOR = 'compressor.js.JsCompressor'
180INACTIVITY_TIMEOUT = 60 * 24 * 365
181SHARED_DRIVE_ROOT = '/Users/azyrus/Projects/sharedfiles/'
182
183BASE_ADDRESS = '{}:8000'.format(os.environ.get('HQ_PORT_8000_TCP_ADDR', 'localhost'))
184
185######## Email setup ########
186# email settings: these ones are the custom hq ones
187EMAIL_LOGIN = "notifications@dimagi.com"
188EMAIL_PASSWORD = "******"
189EMAIL_SMTP_HOST = "smtp.gmail.com"
190EMAIL_SMTP_PORT = 587
191EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
192
193####### Bitly ########
194
195BITLY_LOGIN = None
196
197####### Jar signing config ########
198
199_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
200JAR_SIGN = {
201 "jad_tool": os.path.join(_ROOT_DIR, "corehq", "apps", "app_manager", "JadTool.jar"),
202 "key_store": os.path.join(_ROOT_DIR, "InsecureTestingKeyStore"),
203 "key_alias": "javarosakey",
204 "store_pass": "onetwothreefourfive",
205 "key_pass": "onetwothreefourfive",
206}
207
208AUDIT_MODEL_SAVE = ['django.contrib.auth.models.User']
209
210AUDIT_ADMIN_VIEWS = False
211
212SECRET_KEY = 'secrettravis'
213
214# No logging
215LOCAL_LOGGING_HANDLERS = {
216 'null': {
217 'level': 'DEBUG',
218 'class': 'logging.NullHandler',
219 },
220}
221
222LOCAL_LOGGING_LOGGERS = {
223 '': {
224 'level': 'CRITICAL',
225 'handler': 'null',
226 'propagate': True,
227 },
228 'pillowtop': {
229 'level': 'CRITICAL',
230 'handler': 'null',
231 'propagate': True,
232 },
233 'notify': {
234 'level': 'CRITICAL',
235 'handler': 'null',
236 'propagate': True,
237 },
238}
239
240
241PHONE_TIMEZONES_HAVE_BEEN_PROCESSED = True
242PHONE_TIMEZONES_SHOULD_BE_PROCESSED = True
243
244ENABLE_PRELOGIN_SITE = True
245
246TESTS_SHOULD_TRACK_CLEANLINESS = True
247
248# touchforms must be running when this is false or not set
249# see also corehq.apps.sms.tests.util.TouchformsTestCase
250SKIP_TOUCHFORMS_TESTS = True
251
252PILLOWTOP_MACHINE_ID = 'testhq'
253
254ELASTICSEARCH_VERSION = 1.7
255
256CACHE_REPORTS = True
257
258if os.environ.get("COMMCAREHQ_BOOTSTRAP") == "yes":
259 UNIT_TESTING = False
260 ADMINS = (('Admin', 'admin@example.com'),)
261
262 CELERY_SEND_TASK_ERROR_EMAILS = True
263 LESS_DEBUG = True
264 COMPRESS_OFFLINE = False
265
266 XFORMS_PLAYER_URL = 'http://127.0.0.1:4444'
267
268 TOUCHFORMS_API_USER = 'admin@example.com'
269 TOUCHFORMS_API_PASSWORD = 'password'
270
271 FORMPLAYER_URL = 'http://formplayer:8010'
272
273 CCHQ_API_THROTTLE_REQUESTS = 200
274 CCHQ_API_THROTTLE_TIMEFRAME = 10
275
276 RESTORE_PAYLOAD_DIR_NAME = 'restore'
277 SHARED_TEMP_DIR_NAME = 'temp'
278
279BIGCOUCH = True
280
281LOCAL_APPS = (
282 'kombu.transport.django', # required for celery
283)
284
285LESS_DEBUG = True
286COMPRESS_ENABLED = False
287COMPRESS_OFFLINE = False