-
-
Notifications
You must be signed in to change notification settings - Fork 218
/
settings.py
executable file
·2101 lines (1808 loc) · 72.5 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
# flake8: noqa: F405
import inspect
from collections import defaultdict
import importlib
import os
from django.contrib import messages
import settingshelper as helper
DEBUG = True
# clone http://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
# For Single Sign On (SSO) Implementations
SAML2_DEBUG = False
ENFORCE_SSO_LOGIN = False
# 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_TOGGLE_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"
# this preserves current behavior prior to Django 5.0,
# where timezone support will be enabled by default
USE_TZ = False
# 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'),
('por', 'Portuguese'),
)
STATICI18N_FILENAME_FUNCTION = 'statici18n.utils.legacy_filename'
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'),
)
YARN_COMPONENTS = os.path.join(FILEPATH, 'node_modules')
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
'compressor.finders.CompressorFinder',
)
STATICFILES_DIRS = [
YARN_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.SecureCookiesMiddleware',
'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',
'corehq.apps.auditcare.middleware.AuditMiddleware',
'no_exceptions.middleware.NoExceptionsMiddleware',
'corehq.apps.locations.middleware.LocationAccessMiddleware',
'corehq.apps.cloudcare.middleware.CloudcareMiddleware',
'field_audit.middleware.FieldAuditMiddleware',
]
X_FRAME_OPTIONS = 'DENY'
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
# time in minutes before forced logout due to inactivity
INACTIVITY_TIMEOUT = 60 * 24 * 14
SECURE_TIMEOUT = 30
DISABLE_AUTOCOMPLETE_ON_SENSITIVE_FORMS = False
MINIMUM_ZXCVBN_SCORE = 2
MINIMUM_PASSWORD_LENGTH = 8
CUSTOM_PASSWORD_STRENGTH_MESSAGE = ''
ADD_CAPTCHA_FIELD_TO_FORMS = False
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'corehq.apps.domain.auth.ApiKeyFallbackBackend',
'corehq.apps.sso.backends.SsoBackend',
'corehq.apps.domain.auth.ConnectIDAuthBackend'
]
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_AUTO_FIELD = 'django.db.models.AutoField'
DEFAULT_APPS = (
'corehq.apps.celery.Config',
'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',
'captcha',
'couchdbkit.ext.django',
'crispy_forms',
'crispy_bootstrap3to5',
'field_audit',
'gunicorn',
'compressor',
'tastypie',
'django_otp',
'django_otp.plugins.otp_static',
'django_otp.plugins.otp_totp',
'two_factor',
'two_factor.plugins.phonenumber',
'ws4redis',
'statici18n',
'django_user_agents',
'oauth2_provider',
)
SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error']
RECAPTCHA_PRIVATE_KEY = ''
RECAPTCHA_PUBLIC_KEY = ''
CRISPY_TEMPLATE_PACK = 'bootstrap3to5'
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap3to5"
FIELD_AUDIT_AUDITORS = [
"corehq.apps.users.auditors.HQAuditor",
"field_audit.auditors.SystemUserAuditor",
]
HQ_APPS = (
'django_digest',
'corehq.apps.auditcare.AuditcareConfig',
'casexml.apps.case',
'corehq.apps.casegroups',
'casexml.apps.phone',
'casexml.apps.stock',
'corehq.apps.cleanup',
'corehq.apps.cloudcare',
'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.enterprise',
'corehq.apps.formplayer_api',
'corehq.apps.hqadmin.app_config.HqAdminModule',
'corehq.apps.hqcase',
'corehq.apps.hqwebapp.apps.HqWebAppConfig',
'corehq.apps.hqmedia',
'corehq.apps.integration',
'corehq.apps.linked_domain',
'corehq.apps.locations',
'corehq.apps.products',
'corehq.apps.programs',
'corehq.apps.registry.app_config.RegistryAppConfig',
'corehq.project_limits',
'corehq.apps.commtrack',
'corehq.apps.consumption',
'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.AppManagerAppConfig',
'corehq.apps.es.app_config.ElasticAppConfig',
'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.email',
'corehq.apps.events',
'corehq.apps.geospatial',
'corehq.apps.smsforms',
'corehq.apps.sso',
'corehq.apps.ivr',
'corehq.messaging.MessagingAppConfig',
'corehq.messaging.scheduling',
'corehq.messaging.scheduling.scheduling_partitioned',
'corehq.messaging.smsbackends.tropo',
'corehq.messaging.smsbackends.turn',
'corehq.messaging.smsbackends.twilio',
'corehq.messaging.smsbackends.infobip',
'corehq.messaging.smsbackends.amazon_pinpoint',
'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.trumpia',
'corehq.messaging.smsbackends.apposit',
'corehq.messaging.smsbackends.test',
'corehq.apps.registration',
'corehq.messaging.smsbackends.vertex',
'corehq.messaging.smsbackends.start_enterprise',
'corehq.messaging.smsbackends.ivory_coast_mtn',
'corehq.messaging.smsbackends.airtel_tcl',
'corehq.apps.reports.app_config.ReportsModule',
'corehq.apps.reports_core',
'corehq.apps.saved_reports',
'corehq.apps.userreports.app_config.UserReports',
'corehq.apps.aggregate_ucrs',
'corehq.apps.data_interfaces.app_config.DataInterfacesAppConfig',
'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',
'soil',
'phonelog',
'pillowtop',
'pillow_retry',
'corehq.apps.styleguide',
'corehq.apps.prototype',
'corehq.messaging.smsbackends.grapevine',
'corehq.apps.dashboard',
'corehq.motech',
'corehq.motech.dhis2',
'corehq.motech.fhir',
'corehq.motech.openmrs',
'corehq.motech.repeaters',
'corehq.motech.generic_inbound',
'corehq.toggles',
'corehq.util',
'dimagi.ext',
'corehq.blobs',
'corehq.apps.case_search',
'corehq.apps.zapier.apps.ZapierConfig',
'corehq.apps.translations',
'corehq.apps.app_execution',
# custom reports
'custom.reports.mc',
'custom.ucla',
'custom.up_nrhm',
'custom.common',
'custom.hki',
'custom.bha',
'custom.covid',
'custom.inddex',
'custom.nutrition_project',
'custom.cowin.COWINAppConfig',
'custom.hmhb',
'custom.ccqa',
'corehq.extensions.app_config.ExtensionAppConfig', # this should be last in the list
)
# 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/bootstrap3/base_navigation.html"
BASE_ASYNC_TEMPLATE = "reports/async/basic.html"
LOGIN_TEMPLATE = "login_and_password/bootstrap3/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]"
SAAS_OPS_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
SOLUTIONS_AES_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
# Allows reception of SES Events to the log_email_event endpoint to update
# MessagingSubEvent status This configuration set should be set up for each
# environment here:
# https://console.aws.amazon.com/ses/home?region=us-east-1#configuration-set-list:
SES_CONFIGURATION_SET = None
SNS_EMAIL_EVENT_SECRET = None
ENABLE_SOFT_ASSERT_EMAILS = True
IS_DIMAGI_ENVIRONMENT = True
LOCAL_SERVER_ENVIRONMENT = 'localdev'
SERVER_ENVIRONMENT = LOCAL_SERVER_ENVIRONMENT
ICDS_ENVS = ('icds',)
# environments located in india, this should not even include staging
INDIAN_ENVIRONMENTS = ('india', 'icds-cas', 'icds-staging')
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'
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.registry.fixtures.registry_fixture_generator",
"corehq.apps.case_search.fixtures.case_search_fixture_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_REMINDER_CASE_UPDATE_BULK_QUEUE = 'reminder_rule_queue' # override in localsettings
CELERY_REPEAT_RECORD_QUEUE = 'repeat_record_queue'
CELERY_REPEAT_RECORD_DATASOURCE_QUEUE = 'repeat_record_queue' # override in localsettings
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
# Default serializer should be changed back to 'json' after
# https://github.com/celery/celery/issues/6759 is fixed
CELERY_TASK_SERIALIZER = 'pickle' # this value is ignored in commcare hq code, which will continue to default to json. it is used only for the celery inspect module". See corehq.apps.celery.shared_task
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,
"malt_generation_queue": 6 * 60 * 60,
"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
# Used by the new reminders framework
LOCAL_AVAILABLE_CUSTOM_SCHEDULING_CONTENT = {}
AVAILABLE_CUSTOM_SCHEDULING_CONTENT = {
"UCLA_GENERAL_HEALTH":
["custom.ucla.api.general_health_message_bank_content_new",
"UCLA: General Health Message Bank"],
"UCLA_MENTAL_HEALTH":
["custom.ucla.api.mental_health_message_bank_content_new",
"UCLA: Mental Health Message Bank"],
"UCLA_SEXUAL_HEALTH":
["custom.ucla.api.sexual_health_message_bank_content_new",
"UCLA: Sexual Health Message Bank"],
"UCLA_MED_ADHERENCE":
["custom.ucla.api.med_adherence_message_bank_content_new",
"UCLA: Med Adherence Message Bank"],
"UCLA_SUBSTANCE_USE":
["custom.ucla.api.substance_use_message_bank_content_new",
"UCLA: Substance Use Message Bank"],
}
# Used by the old reminders framework
LOCAL_AVAILABLE_CUSTOM_REMINDER_RECIPIENTS = {}
AVAILABLE_CUSTOM_REMINDER_RECIPIENTS = {
'HOST_CASE_OWNER_LOCATION':
['corehq.apps.reminders.custom_recipients.host_case_owner_location',
"Custom: Extension Case -> Host Case -> Owner (which is a location)"],
'HOST_CASE_OWNER_LOCATION_PARENT':
['corehq.apps.reminders.custom_recipients.host_case_owner_location_parent',
"Custom: Extension Case -> Host Case -> Owner (which is a location) -> Parent location"],
'MOBILE_WORKER_CASE_OWNER_LOCATION_PARENT':
['custom.abt.messaging.custom_recipients.abt_mobile_worker_case_owner_location_parent_old_framework',
"Abt: The case owner's location's parent location"],
'LOCATION_CASE_OWNER_PARENT_LOCATION':
['custom.abt.messaging.custom_recipients.abt_location_case_owner_parent_location_old_framework',
"Abt: The case owner location's parent location"],
}
# Used by the new reminders framework
LOCAL_AVAILABLE_CUSTOM_SCHEDULING_RECIPIENTS = {}
AVAILABLE_CUSTOM_SCHEDULING_RECIPIENTS = {
'HOST_CASE_OWNER_LOCATION':
['corehq.messaging.scheduling.custom_recipients.host_case_owner_location',
"Custom: Extension Case -> Host Case -> Owner (which is a location)"],
'HOST_CASE_OWNER_LOCATION_PARENT':
['corehq.messaging.scheduling.custom_recipients.host_case_owner_location_parent',
"Custom: Extension Case -> Host Case -> Owner (which is a location) -> Parent location"],
'MOBILE_WORKER_CASE_OWNER_LOCATION_PARENT':
['custom.abt.messaging.custom_recipients.abt_mobile_worker_case_owner_location_parent_new_framework',
"Abt: The case owner's location's parent location"],
'LOCATION_CASE_OWNER_PARENT_LOCATION':
['custom.abt.messaging.custom_recipients.abt_location_case_owner_parent_location_new_framework',
"Abt: The case owner location's parent location"],
}
LOCAL_AVAILABLE_CUSTOM_RULE_CRITERIA = {}
AVAILABLE_CUSTOM_RULE_CRITERIA = {
'COVID_US_ASSOCIATED_USER_CASES': 'custom.covid.rules.custom_criteria.associated_usercase_closed'
}
LOCAL_AVAILABLE_CUSTOM_RULE_ACTIONS = {}
AVAILABLE_CUSTOM_RULE_ACTIONS = {
'COVID_US_CLOSE_CASES_ASSIGNED_CHECKIN': 'custom.covid.rules.custom_actions.close_cases_assigned_to_checkin',
'COVID_US_SET_ACTIVITY_COMPLETE_TODAY':
'custom.covid.rules.custom_actions.set_all_activity_complete_date_to_today',
'GCC_SANGATH_SANITIZE_SESSIONS_PEER_RATING':
'custom.gcc_sangath.rules.custom_actions.sanitize_session_peer_rating',
'DFCI_SWASTH_UPDATE_COUNSELLOR_LOAD': 'custom.dfci_swasth.rules.custom_actions.update_counsellor_load',
}
####### auditcare parameters #######
AUDIT_ALL_VIEWS = False
AUDIT_VIEWS = []
AUDIT_MODULES = []
AUDIT_ADMIN_VIEWS = False
# Don't use google analytics unless overridden in localsettings
ANALYTICS_IDS = {
'GOOGLE_ANALYTICS_API_ID': '',
'KISSMETRICS_KEY': '',
'HUBSPOT_ACCESS_TOKEN': '',
'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 = ''
OPEN_EXCHANGE_RATES_API_ID = ''
# 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
RUN_DEDUPLICATION_PILLOW = True
# Repeaters in the order in which they should appear in "Data Forwarding"
REPEATER_CLASSES = [
'corehq.motech.repeaters.models.FormRepeater',
'corehq.motech.repeaters.models.CaseRepeater',
'corehq.motech.repeaters.models.CreateCaseRepeater',
'corehq.motech.repeaters.models.UpdateCaseRepeater',
'corehq.motech.repeaters.models.ReferCaseRepeater',
'corehq.motech.repeaters.models.DataRegistryCaseUpdateRepeater',
'corehq.motech.repeaters.models.ShortFormRepeater',
'corehq.motech.repeaters.models.AppStructureRepeater',
'corehq.motech.repeaters.models.UserRepeater',
'corehq.motech.repeaters.models.LocationRepeater',
'corehq.motech.repeaters.models.DataSourceRepeater',
'corehq.motech.fhir.repeaters.FHIRRepeater',
'corehq.motech.openmrs.repeaters.OpenmrsRepeater',
'corehq.motech.dhis2.repeaters.Dhis2Repeater',
'corehq.motech.dhis2.repeaters.Dhis2EntityRepeater',
'custom.cowin.repeaters.BeneficiaryRegistrationRepeater',
'custom.cowin.repeaters.BeneficiaryVaccinationRepeater',
'corehq.motech.repeaters.expression.repeaters.CaseExpressionRepeater',
'corehq.motech.repeaters.expression.repeaters.FormExpressionRepeater',
'corehq.motech.repeaters.expression.repeaters.ArcGISFormExpressionRepeater',
]
# Override this in localsettings to add new repeater types
LOCAL_REPEATER_CLASSES = []
# tuple of fully qualified repeater class names that are enabled.
# Set to None to enable all or empty tuple to disable all.
# This will not prevent users from creating
REPEATERS_WHITELIST = None
# how many tasks to split the check_repeaters process into
CHECK_REPEATERS_PARTITION_COUNT = 1
# 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 = 5
# If elasticsearch queries take more than this, they result in timeout errors
ES_SEARCH_TIMEOUT = 30
BITLY_OAUTH_TOKEN = None
OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL = 'oauth2_provider.AccessToken'
OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application'
def _pkce_required(client_id):
from corehq.apps.hqwebapp.models import pkce_required
return pkce_required(client_id)
OAUTH2_PROVIDER = {
# until we have clearer project-level checks on this, just expire the token every
# 15 minutes to match HIPAA constraints.
# https://django-oauth-toolkit.readthedocs.io/en/latest/settings.html#access-token-expire-seconds
'ACCESS_TOKEN_EXPIRE_SECONDS': 15 * 60,
'PKCE_REQUIRED': _pkce_required,
'SCOPES': {
'access_apis': 'Access API data on all your CommCare projects',
'reports:view': 'Allow users to view and download all report data',
'mobile_access': 'Allow access to mobile sync and submit endpoints',
'sync': '(Deprecated, do not use) Allow access to mobile endpoints',
},
'REFRESH_TOKEN_EXPIRE_SECONDS': 60 * 60 * 24 * 15, # 15 days
}
# 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 = AVAILABLE_COMPRESS_PRECOMPILERS = (
('text/less', 'corehq.apps.hqwebapp.precompilers.LessFilter'),
('text/scss', 'corehq.apps.hqwebapp.precompilers.SassFilter'),
)
# 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 and not UNIT_TESTING # noqa: E731
COMPRESS_OFFLINE = lambda: not DEBUG and not UNIT_TESTING # noqa: E731
COMPRESS_FILTERS = {
'css': [
'compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.cssmin.rCSSMinFilter',
],
'js': [
'compressor.filters.jsmin.rJSMinFilter',
],
}
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: