forked from dimagi/commcare-hq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
executable file
·2135 lines (1868 loc) · 76.7 KB
/
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
import inspect
from collections import defaultdict
import importlib
import os
from django.contrib import messages
import settingshelper as helper
DEBUG = True
# clone https://github.com/dimagi/Vellum into submodules/formdesigner and use
# this to select various versions of Vellum source on the form designer page.
# Acceptable values:
# None - production mode
# "dev" - use raw vellum source (submodules/formdesigner/src)
# "dev-min" - use built/minified vellum (submodules/formdesigner/_build/src)
VELLUM_DEBUG = None
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# gets set to False for unit tests that run without the database
DB_ENABLED = True
UNIT_TESTING = helper.is_testing()
DISABLE_RANDOM_TOGGLES = UNIT_TESTING
# Setting to declare always_enabled/always_disabled toggle states for domains
# declaring toggles here avoids toggle lookups from cache for all requests.
# Example format
# STATIC_TOGGLES_STATES = {
# 'toggle_slug': {
# 'always_enabled': ['domain1', 'domain2],
# 'always_disabled': ['domain4', 'domain3],
# }
# }
STATIC_TOGGLE_STATES = {}
ADMINS = ()
MANAGERS = ADMINS
# Ensure that extraneous Tastypie formats are not actually used
# Curiously enough, browsers prefer html, then xml, lastly (or not at all) json
# so removing html from the this variable annoyingly makes it render as XML
# in the browser, when we want JSON. So I've added this commented
# to document intent, but it should only really be activated
# when we have logic in place to treat direct browser access specially.
#TASTYPIE_DEFAULT_FORMATS=['json', 'xml', 'yaml']
# default to the system's timezone settings
TIME_ZONE = "UTC"
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
LANGUAGES = (
('en', 'English'),
('es', 'Spanish'),
('fra', 'French'), # we need this alias
('hin', 'Hindi'),
('sw', 'Swahili'),
)
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/media/'
STATIC_URL = '/static/'
STATIC_CDN = ''
FILEPATH = BASE_DIR
# These templates are put on the server during deploy by fabric
SERVICE_DIR = os.path.join(FILEPATH, 'deployment', 'commcare-hq-deploy', 'fab', 'services', 'templates')
# media for user uploaded media. in general this won't be used at all.
MEDIA_ROOT = os.path.join(FILEPATH, 'mediafiles')
STATIC_ROOT = os.path.join(FILEPATH, 'staticfiles')
# Django i18n searches for translation files (django.po) within this dir
# and then in the locale/ directories of installed apps
LOCALE_PATHS = (
os.path.join(FILEPATH, 'locale'),
)
BOWER_COMPONENTS = os.path.join(FILEPATH, 'bower_components')
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
'compressor.finders.CompressorFinder',
)
STATICFILES_DIRS = [
BOWER_COMPONENTS,
]
# bleh, why did this submodule have to be removed?
# deploy fails if this item is present and the path does not exist
_formdesigner_path = os.path.join(FILEPATH, 'submodules', 'formdesigner')
if os.path.exists(_formdesigner_path):
STATICFILES_DIRS += (('formdesigner', _formdesigner_path),)
del _formdesigner_path
LOG_HOME = FILEPATH
COUCH_LOG_FILE = "%s/%s" % (FILEPATH, "commcarehq.couch.log")
DJANGO_LOG_FILE = "%s/%s" % (FILEPATH, "commcarehq.django.log")
ACCOUNTING_LOG_FILE = "%s/%s" % (FILEPATH, "commcarehq.accounting.log")
ANALYTICS_LOG_FILE = "%s/%s" % (FILEPATH, "commcarehq.analytics.log")
FORMPLAYER_TIMING_FILE = "%s/%s" % (FILEPATH, "formplayer.timing.log")
FORMPLAYER_DIFF_FILE = "%s/%s" % (FILEPATH, "formplayer.diff.log")
SOFT_ASSERTS_LOG_FILE = "%s/%s" % (FILEPATH, "soft_asserts.log")
MAIN_COUCH_SQL_DATAMIGRATION = "%s/%s" % (FILEPATH, "main_couch_sql_datamigration.log")
LOCAL_LOGGING_CONFIG = {}
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/static/admin/'
# Make this unique, and don't share it with anybody - put into localsettings.py
SECRET_KEY = 'you should really change this'
MIDDLEWARE = [
'corehq.middleware.NoCacheMiddleware',
'corehq.middleware.SelectiveSessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.common.BrokenLinkEmailsMiddleware',
'django_otp.middleware.OTPMiddleware',
'django_user_agents.middleware.UserAgentMiddleware',
'corehq.middleware.OpenRosaMiddleware',
'corehq.util.global_request.middleware.GlobalRequestMiddleware',
'corehq.apps.users.middleware.UsersMiddleware',
'corehq.middleware.SentryContextMiddleware',
'corehq.apps.domain.middleware.DomainMigrationMiddleware',
'corehq.middleware.TimeoutMiddleware',
'corehq.middleware.LogLongRequestMiddleware',
'corehq.apps.domain.middleware.CCHQPRBACMiddleware',
'corehq.apps.domain.middleware.DomainHistoryMiddleware',
'corehq.apps.domain.project_access.middleware.ProjectAccessMiddleware',
'casexml.apps.phone.middleware.SyncTokenMiddleware',
'auditcare.middleware.AuditMiddleware',
'no_exceptions.middleware.NoExceptionsMiddleware',
'corehq.apps.locations.middleware.LocationAccessMiddleware',
'corehq.apps.cloudcare.middleware.CloudcareMiddleware',
]
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
# time in minutes before forced logout due to inactivity
INACTIVITY_TIMEOUT = 60 * 24 * 14
SECURE_TIMEOUT = 30
ENABLE_DRACONIAN_SECURITY_FEATURES = False
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'corehq.apps.domain.auth.ApiKeyFallbackBackend',
]
PASSWORD_HASHERS = (
# this is the default list with SHA1 moved to the front
'django.contrib.auth.hashers.SHA1PasswordHasher',
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
'django.contrib.auth.hashers.MD5PasswordHasher',
'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',
'django.contrib.auth.hashers.CryptPasswordHasher',
)
ROOT_URLCONF = "urls"
DEFAULT_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
'django_celery_results',
'django_prbac',
'djng',
'captcha',
'couchdbkit.ext.django',
'crispy_forms',
'gunicorn',
'compressor',
'tastypie',
'django_otp',
'django_otp.plugins.otp_static',
'django_otp.plugins.otp_totp',
'two_factor',
'ws4redis',
'statici18n',
'django_user_agents',
)
CAPTCHA_FIELD_TEMPLATE = 'hq-captcha-field.html'
CRISPY_TEMPLATE_PACK = 'bootstrap3'
CRISPY_ALLOWED_TEMPLATE_PACKS = (
'bootstrap',
'bootstrap3',
)
HQ_APPS = (
'django_digest',
'auditcare',
'casexml.apps.case',
'corehq.apps.casegroups',
'corehq.apps.case_migrations',
'casexml.apps.phone',
'casexml.apps.stock',
'corehq.apps.cleanup',
'corehq.apps.cloudcare',
'corehq.apps.couch_sql_migration',
'corehq.apps.smsbillables',
'corehq.apps.accounting',
'corehq.apps.appstore',
'corehq.apps.data_analytics',
'corehq.apps.data_pipeline_audit',
'corehq.apps.domain',
'corehq.apps.domain_migration_flags',
'corehq.apps.dump_reload',
'corehq.apps.hqadmin.app_config.HqAdminModule',
'corehq.apps.hqcase',
'corehq.apps.hqwebapp',
'corehq.apps.hqmedia',
'corehq.apps.integration',
'corehq.apps.linked_domain',
'corehq.apps.locations',
'corehq.apps.products',
'corehq.apps.programs',
'corehq.project_limits',
'corehq.apps.commtrack',
'corehq.apps.consumption',
'corehq.apps.tzmigration',
'corehq.celery_monitoring.app_config.CeleryMonitoringAppConfig',
'corehq.form_processor.app_config.FormProcessorAppConfig',
'corehq.sql_db.app_config.SqlDbAppConfig',
'corehq.sql_accessors',
'corehq.sql_proxy_accessors',
'corehq.sql_proxy_standby_accessors',
'corehq.pillows',
'couchforms',
'couchexport',
'dimagi.utils',
'langcodes',
'corehq.apps.data_dictionary',
'corehq.apps.analytics',
'corehq.apps.callcenter',
'corehq.apps.change_feed',
'corehq.apps.custom_data_fields',
'corehq.apps.receiverwrapper',
'corehq.apps.app_manager',
'corehq.apps.es',
'corehq.apps.fixtures',
'corehq.apps.case_importer',
'corehq.apps.reminders',
'corehq.apps.translations',
'corehq.apps.user_importer',
'corehq.apps.users',
'corehq.apps.settings',
'corehq.apps.ota',
'corehq.apps.groups',
'corehq.apps.mobile_auth',
'corehq.apps.sms',
'corehq.apps.smsforms',
'corehq.apps.ivr',
'corehq.messaging',
'corehq.messaging.scheduling',
'corehq.messaging.scheduling.scheduling_partitioned',
'corehq.messaging.smsbackends.tropo',
'corehq.messaging.smsbackends.turn',
'corehq.messaging.smsbackends.twilio',
'corehq.apps.dropbox',
'corehq.messaging.smsbackends.megamobile',
'corehq.messaging.ivrbackends.kookoo',
'corehq.messaging.smsbackends.sislog',
'corehq.messaging.smsbackends.yo',
'corehq.messaging.smsbackends.telerivet',
'corehq.messaging.smsbackends.mach',
'corehq.messaging.smsbackends.http',
'corehq.messaging.smsbackends.smsgh',
'corehq.messaging.smsbackends.push',
'corehq.messaging.smsbackends.starfish',
'corehq.messaging.smsbackends.apposit',
'corehq.messaging.smsbackends.test',
'corehq.apps.registration',
'corehq.messaging.smsbackends.unicel',
'corehq.messaging.smsbackends.icds_nic',
'corehq.messaging.smsbackends.vertex',
'corehq.messaging.smsbackends.start_enterprise',
'corehq.messaging.smsbackends.ivory_coast_mtn',
'corehq.messaging.smsbackends.karix',
'corehq.messaging.smsbackends.airtel_tcl',
'corehq.apps.reports.app_config.ReportsModule',
'corehq.apps.reports_core',
'corehq.apps.saved_reports',
'corehq.apps.userreports',
'corehq.apps.aggregate_ucrs',
'corehq.apps.data_interfaces',
'corehq.apps.export',
'corehq.apps.builds',
'corehq.apps.api',
'corehq.apps.notifications',
'corehq.apps.cachehq',
'corehq.apps.toggle_ui',
'corehq.couchapps',
'corehq.preindex',
'corehq.tabs',
'custom.openclinica',
'fluff',
'fluff.fluff_filter',
'soil',
'toggle',
'phonelog',
'pillowtop',
'pillow_retry',
'corehq.apps.styleguide',
'corehq.messaging.smsbackends.grapevine',
'corehq.apps.dashboard',
'corehq.motech',
'corehq.motech.dhis2',
'corehq.motech.openmrs',
'corehq.motech.repeaters',
'corehq.util',
'dimagi.ext',
'corehq.blobs',
'corehq.apps.case_search',
'corehq.apps.zapier.apps.ZapierConfig',
'corehq.apps.translations',
# custom reports
'pact',
'custom.reports.mc',
'custom.apps.crs_reports',
'custom.m4change',
'custom.succeed',
'custom.ucla',
'custom.intrahealth',
'custom.up_nrhm',
'custom.common',
'custom.icds',
'custom.icds.data_management',
'custom.icds_reports',
'custom.nic_compliance',
'custom.hki',
'custom.champ',
'custom.aaa',
'custom.inddex',
'custom.ccqa',
)
# any built-in management commands we want to override should go in hqscripts
INSTALLED_APPS = ('hqscripts',) + DEFAULT_APPS + HQ_APPS
# after login, django redirects to this URL
# rather than the default 'accounts/profile'
LOGIN_REDIRECT_URL = 'homepage'
REPORT_CACHE = 'default' # or e.g. 'redis'
# When set to False, HQ will not cache any reports using is_cacheable
CACHE_REPORTS = True
####### Domain settings #######
DOMAIN_MAX_REGISTRATION_REQUESTS_PER_DAY = 99
DOMAIN_SELECT_URL = "/domain/select/"
# This is not used by anything in CommCare HQ, leaving it here in case anything
# in Django unexpectedly breaks without it.
LOGIN_URL = "/accounts/login/"
# If a user tries to access domain admin pages but isn't a domain
# administrator, here's where he/she is redirected
DOMAIN_NOT_ADMIN_REDIRECT_PAGE_NAME = "homepage"
PAGES_NOT_RESTRICTED_FOR_DIMAGI = (
'/a/{domain}/settings/project/billing/statements/',
'/a/{domain}/settings/project/billing_information/',
'/a/{domain}/settings/project/flags/',
'/a/{domain}/settings/project/internal/calculations/',
'/a/{domain}/settings/project/internal/info/',
'/a/{domain}/settings/project/internal_subscription_management/',
'/a/{domain}/settings/project/project_limits/',
'/a/{domain}/settings/project/subscription/',
)
####### Release Manager App settings #######
RELEASE_FILE_PATH = os.path.join("data", "builds")
## soil heartbead config ##
SOIL_HEARTBEAT_CACHE_KEY = "django-soil-heartbeat"
####### Shared/Global/UI Settings #######
# restyle some templates
BASE_TEMPLATE = "hqwebapp/base.html"
BASE_ASYNC_TEMPLATE = "reports/async/basic.html"
LOGIN_TEMPLATE = "login_and_password/login.html"
LOGGEDOUT_TEMPLATE = LOGIN_TEMPLATE
CSRF_FAILURE_VIEW = 'corehq.apps.hqwebapp.views.csrf_failure'
# These are non-standard setting names that are used in localsettings
# The standard variables are then set to these variables after localsettings
# Todo: Change to use standard settings variables
EMAIL_LOGIN = "[email protected]"
EMAIL_PASSWORD = "changeme"
EMAIL_SMTP_HOST = "smtp.gmail.com"
EMAIL_SMTP_PORT = 587
# These are the normal Django settings
EMAIL_USE_TLS = True
# the physical server emailing - differentiate if needed
SERVER_EMAIL = '[email protected]'
DEFAULT_FROM_EMAIL = '[email protected]'
SUPPORT_EMAIL = "[email protected]"
PROBONO_SUPPORT_EMAIL = '[email protected]'
ACCOUNTS_EMAIL = '[email protected]'
DATA_EMAIL = '[email protected]'
SUBSCRIPTION_CHANGE_EMAIL = '[email protected]'
INTERNAL_SUBSCRIPTION_CHANGE_EMAIL = '[email protected]'
BILLING_EMAIL = '[email protected]'
INVOICING_CONTACT_EMAIL = '[email protected]'
GROWTH_EMAIL = '[email protected]'
MASTER_LIST_EMAIL = '[email protected]'
SALES_EMAIL = '[email protected]'
EULA_CHANGE_EMAIL = '[email protected]'
PRIVACY_EMAIL = '[email protected]'
CONTACT_EMAIL = '[email protected]'
FEEDBACK_EMAIL = '[email protected]'
BOOKKEEPER_CONTACT_EMAILS = []
SOFT_ASSERT_EMAIL = '[email protected]'
DAILY_DEPLOY_EMAIL = None
EMAIL_SUBJECT_PREFIX = '[commcarehq] '
SAAS_REPORTING_EMAIL = None
# Return-Path is the email used to forward BOUNCE & COMPLAINT notifications
# This email must be a REAL email address, not a mailing list, otherwise
# the emails from mailer daemon will be swallowed up by spam filters.
RETURN_PATH_EMAIL = None
# This will trigger a periodic task to check the RETURN_PATH_EMAIL inbox for
# SES bounce and complaint notifications.
RETURN_PATH_EMAIL_PASSWORD = None
ENABLE_SOFT_ASSERT_EMAILS = True
IS_DIMAGI_ENVIRONMENT = True
SERVER_ENVIRONMENT = 'localdev'
ICDS_ENVS = ('icds',)
UNLIMITED_RULE_RESTART_ENVS = ('echis', 'pna', 'swiss')
# minimum minutes between updates to user reporting metadata
USER_REPORTING_METADATA_UPDATE_FREQUENCY = 15
USER_REPORTING_METADATA_BATCH_ENABLED = False
USER_REPORTING_METADATA_BATCH_SCHEDULE = {'timedelta': {'minutes': 5}}
BASE_ADDRESS = 'localhost:8000'
J2ME_ADDRESS = ''
# Set this if touchforms can't access HQ via the public URL e.g. if using a self signed cert
# Should include the protocol.
# If this is None, get_url_base() will be used
CLOUDCARE_BASE_URL = None
PAGINATOR_OBJECTS_PER_PAGE = 15
PAGINATOR_MAX_PAGE_LINKS = 5
# OTA restore fixture generators
FIXTURE_GENERATORS = [
"corehq.apps.users.fixturegenerators.user_groups",
"corehq.apps.fixtures.fixturegenerators.item_lists",
"corehq.apps.callcenter.fixturegenerators.indicators_fixture_generator",
"corehq.apps.products.fixtures.product_fixture_generator",
"corehq.apps.programs.fixtures.program_fixture_generator",
"corehq.apps.app_manager.fixtures.report_fixture_generator",
"corehq.apps.locations.fixtures.location_fixture_generator",
"corehq.apps.locations.fixtures.flat_location_fixture_generator",
"corehq.apps.locations.fixtures.related_locations_fixture_generator",
"custom.m4change.fixtures.report_fixtures.generator",
"custom.m4change.fixtures.location_fixtures.generator",
]
### Shared drive settings ###
# Also see section after localsettings import
SHARED_DRIVE_ROOT = None
# names of directories within SHARED_DRIVE_ROOT
RESTORE_PAYLOAD_DIR_NAME = None
SHARED_TEMP_DIR_NAME = None
SHARED_BLOB_DIR_NAME = 'blobdb'
## django-transfer settings
# These settings must match the apache / nginx config
TRANSFER_SERVER = None # 'apache' or 'nginx'
# name of the directory within SHARED_DRIVE_ROOT
TRANSFER_FILE_DIR_NAME = None
GET_URL_BASE = 'dimagi.utils.web.get_url_base'
CELERY_BROKER_URL = 'redis://localhost:6379/0'
# https://github.com/celery/celery/issues/4226
CELERY_BROKER_POOL_LIMIT = None
CELERY_RESULT_BACKEND = 'django-db'
CELERY_TASK_ANNOTATIONS = {
'*': {
'on_failure': helper.celery_failure_handler,
'trail': False,
}
}
CELERY_MAIN_QUEUE = 'celery'
CELERY_PERIODIC_QUEUE = 'celery_periodic'
CELERY_REMINDER_RULE_QUEUE = 'reminder_rule_queue'
CELERY_REMINDER_CASE_UPDATE_QUEUE = 'reminder_case_update_queue'
CELERY_REPEAT_RECORD_QUEUE = 'repeat_record_queue'
CELERY_LOCATION_REASSIGNMENT_QUEUE = 'celery'
# Will cause a celery task to raise a SoftTimeLimitExceeded exception if
# time limit is exceeded.
CELERY_TASK_SOFT_TIME_LIMIT = 86400 * 2 # 2 days in seconds
# http://docs.celeryproject.org/en/3.1/configuration.html#celery-event-queue-ttl
# Keep messages in the events queue only for 2 hours
CELERY_EVENT_QUEUE_TTL = 2 * 60 * 60
CELERY_TASK_SERIALIZER = 'json' # Default value in celery 4.x
CELERY_ACCEPT_CONTENT = ['json', 'pickle'] # Defaults to ['json'] in celery 4.x. Remove once pickle is not used.
# in seconds
CELERY_HEARTBEAT_THRESHOLDS = {
"analytics_queue": 30 * 60,
"async_restore_queue": 60,
"background_queue": None,
"case_import_queue": 60,
"case_rule_queue": None,
"celery": 60,
"celery_periodic": None,
"email_queue": 30,
"export_download_queue": 30,
"icds_aggregation_queue": None,
"icds_dashboard_reports_queue": None,
"logistics_background_queue": None,
"logistics_reminder_queue": None,
"reminder_case_update_queue": 15 * 60,
"reminder_queue": 15 * 60,
"reminder_rule_queue": 15 * 60,
"repeat_record_queue": 60 * 60,
"saved_exports_queue": 6 * 60 * 60,
"send_report_throttled": 6 * 60 * 60,
"sms_queue": 5 * 60,
"submission_reprocessing_queue": 60 * 60,
"sumologic_logs_queue": 6 * 60 * 60,
"ucr_indicator_queue": None,
"ucr_queue": None,
}
# websockets config
WEBSOCKET_URL = '/ws/'
WS4REDIS_PREFIX = 'ws'
WSGI_APPLICATION = 'ws4redis.django_runserver.application'
WS4REDIS_ALLOWED_CHANNELS = helper.get_allowed_websocket_channels
TEST_RUNNER = 'testrunner.TwoStageTestRunner'
# this is what gets appended to @domain after your accounts
HQ_ACCOUNT_ROOT = "commcarehq.org"
FORMPLAYER_URL = 'http://localhost:8080'
####### SMS Queue Settings #######
# Setting this to False will make the system process outgoing and incoming SMS
# immediately rather than use the queue.
# This should always be set to True in production environments, and the sms_queue
# celery worker(s) should be deployed. We set this to False for tests and (optionally)
# for local testing.
SMS_QUEUE_ENABLED = True
# Number of minutes a celery task will alot for itself (via lock timeout)
SMS_QUEUE_PROCESSING_LOCK_TIMEOUT = 5
# Number of minutes to wait before retrying an unsuccessful processing attempt
# for a single SMS
SMS_QUEUE_REPROCESS_INTERVAL = 5
# Number of minutes to wait before retrying an SMS that has reached
# the default maximum number of processing attempts
SMS_QUEUE_REPROCESS_INDEFINITELY_INTERVAL = 60 * 6
# Max number of processing attempts before giving up on processing the SMS
SMS_QUEUE_MAX_PROCESSING_ATTEMPTS = 3
# Number of minutes to wait before retrying SMS that was delayed because the
# domain restricts sending SMS to certain days/times.
SMS_QUEUE_DOMAIN_RESTRICTED_RETRY_INTERVAL = 15
# The number of hours to wait before counting a message as stale. Stale
# messages will not be processed.
SMS_QUEUE_STALE_MESSAGE_DURATION = 7 * 24
####### Reminders Queue Settings #######
# Setting this to False will make the system fire reminders every
# minute on the periodic queue. Setting to True will queue up reminders
# on the reminders queue.
REMINDERS_QUEUE_ENABLED = False
# If a reminder still has not been processed in this number of minutes, enqueue it
# again.
REMINDERS_QUEUE_ENQUEUING_TIMEOUT = 180
# Number of minutes a celery task will alot for itself (via lock timeout)
REMINDERS_QUEUE_PROCESSING_LOCK_TIMEOUT = 5
# Number of minutes to wait before retrying an unsuccessful processing attempt
# for a single reminder
REMINDERS_QUEUE_REPROCESS_INTERVAL = 5
# Max number of processing attempts before giving up on processing the reminder
REMINDERS_QUEUE_MAX_PROCESSING_ATTEMPTS = 3
# The number of hours to wait before counting a reminder as stale. Stale
# reminders will not be processed.
REMINDERS_QUEUE_STALE_REMINDER_DURATION = 7 * 24
# Reminders rate limiting settings. A single project will only be allowed to
# fire REMINDERS_RATE_LIMIT_COUNT reminders every REMINDERS_RATE_LIMIT_PERIOD
# seconds.
REMINDERS_RATE_LIMIT_COUNT = 30
REMINDERS_RATE_LIMIT_PERIOD = 60
SYNC_CASE_FOR_MESSAGING_ON_SAVE = True
####### auditcare parameters #######
AUDIT_MODEL_SAVE = [
'corehq.apps.app_manager.Application',
'corehq.apps.app_manager.RemoteApp',
]
AUDIT_VIEWS = [
'corehq.apps.settings.views.ChangeMyPasswordView',
'corehq.apps.hqadmin.views.users.AuthenticateAs',
]
AUDIT_MODULES = [
'corehq.apps.reports',
'corehq.apps.userreports',
'corehq.apps.data',
'corehq.apps.registration',
'corehq.apps.hqadmin',
'corehq.apps.accounting',
'tastypie',
]
# Don't use google analytics unless overridden in localsettings
ANALYTICS_IDS = {
'GOOGLE_ANALYTICS_API_ID': '',
'KISSMETRICS_KEY': '',
'HUBSPOT_API_KEY': '',
'HUBSPOT_API_ID': '',
'GTM_ID': '',
'DRIFT_ID': '',
'APPCUES_ID': '',
'APPCUES_KEY': '',
}
ANALYTICS_CONFIG = {
"HQ_INSTANCE": '', # e.g. "www" or "staging"
"DEBUG": False,
"LOG_LEVEL": "warning", # "warning", "debug", "verbose", or "" for no logging
}
GREENHOUSE_API_KEY = ''
MAPBOX_ACCESS_TOKEN = 'pk.eyJ1IjoiZGltYWdpIiwiYSI6ImpZWWQ4dkUifQ.3FNy5rVvLolWLycXPxKVEA'
OPEN_EXCHANGE_RATES_API_ID = ''
# for touchforms maps
GMAPS_API_KEY = "changeme"
# import local settings if we find them
LOCAL_APPS = ()
LOCAL_MIDDLEWARE = ()
LOCAL_PILLOWTOPS = {}
RUN_FORM_META_PILLOW = True
RUN_CASE_SEARCH_PILLOW = True
RUN_UNKNOWN_USER_PILLOW = True
# Set to True to remove the `actions` and `xform_id` fields from the
# ES Case index. These fields contribute high load to the shard
# databases.
CASE_ES_DROP_FORM_FIELDS = False
# tuple of fully qualified repeater class names that are enabled.
# Set to None to enable all or empty tuple to disable all.
REPEATERS_WHITELIST = None
# If ENABLE_PRELOGIN_SITE is set to true, redirect to Dimagi.com urls
ENABLE_PRELOGIN_SITE = False
# dimagi.com urls
PRICING_PAGE_URL = "https://www.dimagi.com/commcare/pricing/"
# Sumologic log aggregator
SUMOLOGIC_URL = None
# on both a single instance or distributed setup this should assume localhost
ELASTICSEARCH_HOST = 'localhost'
ELASTICSEARCH_PORT = 9200
ELASTICSEARCH_MAJOR_VERSION = 1
# If elasticsearch queries take more than this, they result in timeout errors
ES_SEARCH_TIMEOUT = 30
BITLY_OAUTH_TOKEN = None
# this should be overridden in localsettings
INTERNAL_DATA = defaultdict(list)
COUCH_STALE_QUERY = 'update_after' # 'ok' for cloudant
# Run reindex every 10 minutes (by default)
COUCH_REINDEX_SCHEDULE = {'timedelta': {'minutes': 10}}
MESSAGE_LOG_OPTIONS = {
"abbreviated_phone_number_domains": ["mustmgh", "mgh-cgh-uganda"],
}
PREVIEWER_RE = '^$'
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
DIGEST_LOGIN_FACTORY = 'django_digest.NoEmailLoginFactory'
# Django Compressor
COMPRESS_PRECOMPILERS = (
('text/less', 'corehq.apps.hqwebapp.precompilers.LessFilter'),
)
# if not overwritten in localsettings, these will be replaced by the value they return
# using the local DEBUG value (which we don't have access to here yet)
COMPRESS_ENABLED = lambda: not DEBUG
COMPRESS_OFFLINE = lambda: not DEBUG
COMPRESS_JS_COMPRESSOR = 'corehq.apps.hqwebapp.uglify.JsUglifySourcemapCompressor'
# use 'compressor.js.JsCompressor' for faster local compressing (will get rid of source maps)
COMPRESS_CSS_FILTERS = ['compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.cssmin.rCSSMinFilter']
LESS_B3_PATHS = {
'variables': '../../../hqwebapp/less/_hq/includes/variables',
'mixins': '../../../hqwebapp/less/_hq/includes/mixins',
}
USER_AGENTS_CACHE = 'default'
# Invoicing
INVOICE_STARTING_NUMBER = 0
INVOICE_PREFIX = ''
INVOICE_TERMS = ''
INVOICE_FROM_ADDRESS = {}
BANK_ADDRESS = {}
BANK_NAME = ''
BANK_ACCOUNT_NUMBER = ''
BANK_ROUTING_NUMBER_ACH = ''
BANK_ROUTING_NUMBER_WIRE = ''
BANK_SWIFT_CODE = ''
STRIPE_PUBLIC_KEY = ''
STRIPE_PRIVATE_KEY = ''
# mapping of report engine IDs to database configurations
# values must be an alias of a DB in the Django DB configuration
# or a dict of the following format:
# {
# 'WRITE': 'django_db_alias',
# 'READ': [('django_db_alias', query_weighting_int), (...)]
# }
REPORTING_DATABASES = {
'default': 'default',
'ucr': 'default'
}
PL_PROXY_CLUSTER_NAME = 'commcarehq'
USE_PARTITIONED_DATABASE = False
# number of days since last access after which a saved export is considered unused
SAVED_EXPORT_ACCESS_CUTOFF = 35
# override for production
DEFAULT_PROTOCOL = 'http'
# Dropbox
DROPBOX_KEY = ''
DROPBOX_SECRET = ''
DROPBOX_APP_NAME = ''
# Amazon S3
S3_ACCESS_KEY = None
S3_SECRET_KEY = None
# Supervisor RPC
SUPERVISOR_RPC_ENABLED = False
SUBSCRIPTION_USERNAME = None
SUBSCRIPTION_PASSWORD = None
# List of metrics providers to use. Available providers:
# * 'corehq.util.metrics.datadog.DatadogMetrics'
# * 'corehq.util.metrics.prometheus.PrometheusMetrics'
METRICS_PROVIDERS = []
DATADOG_API_KEY = None
DATADOG_APP_KEY = None
SYNCLOGS_SQL_DB_ALIAS = 'default'
# A dict of django apps in which the reads are
# split betweeen the primary and standby db machines
# Example format:
# {
# "users":
# [
# ("pgmain", 5),
# ("pgmainstandby", 5)
# ]
# }
LOAD_BALANCED_APPS = {}
# Override with the PEM export of an RSA private key, for use with any
# encryption or signing workflows.
HQ_PRIVATE_KEY = None
# Set to the list of domain names for which we will run the ICDS SMS indicators
ICDS_SMS_INDICATOR_DOMAINS = []
KAFKA_BROKERS = ['localhost:9092']
KAFKA_API_VERSION = None
MOBILE_INTEGRATION_TEST_TOKEN = None
COMMCARE_HQ_NAME = {
"default": "CommCare HQ",
}
COMMCARE_NAME = {
"default": "CommCare",
}
ENTERPRISE_MODE = False
RESTRICT_DOMAIN_CREATION = False
CUSTOM_LANDING_PAGE = False
TABLEAU_URL_ROOT = "https://icds.commcarehq.org/"
SENTRY_DSN = None
SENTRY_REPOSITORY = 'dimagi/commcare-hq'
SENTRY_ORGANIZATION_SLUG = 'dimagi'
SENTRY_PROJECT_SLUG = 'commcarehq'
# used for creating releases and deploys
SENTRY_API_KEY = None
OBFUSCATE_PASSWORD_FOR_NIC_COMPLIANCE = False
RESTRICT_USED_PASSWORDS_FOR_NIC_COMPLIANCE = False
DATA_UPLOAD_MAX_MEMORY_SIZE = None
# Exports use a lot of fields to define columns. See: https://dimagi-dev.atlassian.net/browse/HI-365
DATA_UPLOAD_MAX_NUMBER_FIELDS = 5000
AUTHPROXY_URL = None
AUTHPROXY_CERT = None
# number of docs for UCR to queue asynchronously at once
# ideally # of documents it takes to process in ~30 min
ASYNC_INDICATORS_TO_QUEUE = 10000
ASYNC_INDICATOR_QUEUE_TIMES = None
DAYS_TO_KEEP_DEVICE_LOGS = 60
NO_DEVICE_LOG_ENVS = list(ICDS_ENVS) + ['production']
UCR_COMPARISONS = {}
MAX_RULE_UPDATES_IN_ONE_RUN = 10000
DEFAULT_ODATA_FEED_LIMIT = 25
# used for providing separate landing pages for different URLs
# default will be used if no hosts match
CUSTOM_LANDING_TEMPLATE = {
# "icds-cas.gov.in": 'icds/login.html',
# "default": 'login_and_password/login.html',
}
ES_SETTINGS = None
ES_XFORM_INDEX_NAME = "xforms_2016-07-07"
ES_XFORM_DISABLE_ALL = False
PHI_API_KEY = None
PHI_PASSWORD = None
STATIC_DATA_SOURCE_PROVIDERS = [
'corehq.apps.callcenter.data_source.call_center_data_source_configuration_provider'
]
BYPASS_SESSIONS_FOR_MOBILE = False
SESSION_BYPASS_URLS = [
r'^/a/{domain}/receiver/',
r'^/a/{domain}/phone/restore/',
r'^/a/{domain}/phone/search/',
r'^/a/{domain}/phone/claim-case/',
r'^/a/{domain}/phone/heartbeat/',
r'^/a/{domain}/phone/keys/',
r'^/a/{domain}/phone/admin_keys/',
r'^/a/{domain}/apps/download/',
]
ALLOW_PHONE_AS_DEFAULT_TWO_FACTOR_DEVICE = False
RATE_LIMIT_SUBMISSIONS = False
# If set to a positive number, exports requested more than this many seconds ago
# without the email option will be quickly rejected.
# This is useful for load-shedding in times of crisis.
STALE_EXPORT_THRESHOLD = None
REQUIRE_TWO_FACTOR_FOR_SUPERUSERS = False
# Use an experimental partitioning algorithm
# that adds messages to the partition with the fewest unprocessed messages
USE_KAFKA_SHORTEST_BACKLOG_PARTITIONER = False
try:
# try to see if there's an environmental variable set for local_settings
custom_settings = os.environ.get('CUSTOMSETTINGS', None)
if custom_settings:
if custom_settings == 'demo':
from settings_demo import *
else:
custom_settings_module = importlib.import_module(custom_settings)
try:
attrlist = custom_settings_module.__all__
except AttributeError:
attrlist = dir(custom_settings_module)
for attr in attrlist:
globals()[attr] = getattr(custom_settings_module, attr)
else:
from localsettings import *
except ImportError as error:
if str(error) != "No module named 'localsettings'":
raise error
# fallback in case nothing else is found - used for readthedocs
from dev_settings import *
# The defaults above are given as a function of (or rather a closure on) DEBUG,
# so if not overridden they need to be evaluated after DEBUG is set
if callable(COMPRESS_ENABLED):
COMPRESS_ENABLED = COMPRESS_ENABLED()
if callable(COMPRESS_OFFLINE):
COMPRESS_OFFLINE = COMPRESS_OFFLINE()
# Unless DISABLE_SERVER_SIDE_CURSORS has explicitly been set, default to True because Django >= 1.11.1 and our
# hosting environments use pgBouncer with transaction pooling. For more information, see:
# https://docs.djangoproject.com/en/1.11/releases/1.11.1/#allowed-disabling-server-side-cursors-on-postgresql
for database in DATABASES.values():
if (
database['ENGINE'] == 'django.db.backends.postgresql_psycopg2' and
database.get('DISABLE_SERVER_SIDE_CURSORS') is None
):
database['DISABLE_SERVER_SIDE_CURSORS'] = True