forked from dimagi/commcare-hq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
executable file
·1931 lines (1677 loc) · 66.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
import importlib
from collections import defaultdict
import os
from urllib import urlencode
from django.contrib import messages
import settingshelper as helper
# odd celery fix
import djcelery
djcelery.setup_loader()
DEBUG = True
LESS_DEBUG = DEBUG
# Enable LESS_WATCH if you want less.js to constantly recompile.
# Useful if you're making changes to the less files and don't want to refresh
# your page.
LESS_WATCH = False
# 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
# 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()
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
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.django.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")
DATADOG_LOG_FILE = "%s/%s" % (FILEPATH, "commcarehq.datadog.log")
UCR_TIMING_FILE = "%s/%s" % (FILEPATH, "ucr.timing.log")
UCR_DIFF_FILE = "%s/%s" % (FILEPATH, "ucr.diff.log")
UCR_EXCEPTION_FILE = "%s/%s" % (FILEPATH, "ucr.exception.log")
NIKSHAY_DATAMIGRATION = "%s/%s" % (FILEPATH, "nikshay_datamigration.log")
LOCAL_LOGGING_HANDLERS = {}
LOCAL_LOGGING_LOGGERS = {}
# 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'
# Add this to localsettings and set it to False, so that CSRF protection is enabled on localhost
CSRF_SOFT_MODE = True
MIDDLEWARE_CLASSES = [
'corehq.middleware.NoCacheMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.common.BrokenLinkEmailsMiddleware',
'django_otp.middleware.OTPMiddleware',
'corehq.middleware.OpenRosaMiddleware',
'corehq.util.global_request.middleware.GlobalRequestMiddleware',
'corehq.apps.users.middleware.UsersMiddleware',
'corehq.apps.domain.middleware.DomainMigrationMiddleware',
'corehq.middleware.TimeoutMiddleware',
'corehq.apps.domain.middleware.CCHQPRBACMiddleware',
'corehq.apps.domain.middleware.DomainHistoryMiddleware',
'casexml.apps.phone.middleware.SyncTokenMiddleware',
'auditcare.middleware.AuditMiddleware',
'no_exceptions.middleware.NoExceptionsMiddleware',
'corehq.apps.locations.middleware.LocationAccessMiddleware',
]
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
# time in minutes before forced logout due to inactivity
INACTIVITY_TIMEOUT = 60 * 24 * 14
SECURE_TIMEOUT = 30
ENABLE_DRACONIAN_SECURITY_FEATURES = False
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 = (
'corehq.apps.userhack', # this has to be above auth
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
'djcelery',
'djtables',
'django_prbac',
'djangular',
'captcha',
'couchdbkit.ext.django',
'crispy_forms',
'gunicorn',
'compressor',
'mptt',
'tastypie',
'django_otp',
'django_otp.plugins.otp_static',
'django_otp.plugins.otp_totp',
'two_factor',
'ws4redis',
'statici18n',
)
CAPTCHA_FIELD_TEMPLATE = 'hq-captcha-field.html'
CRISPY_TEMPLATE_PACK = 'bootstrap3'
CRISPY_ALLOWED_TEMPLATE_PACKS = (
'bootstrap',
'bootstrap3',
)
HQ_APPS = (
'django_digest',
'auditcare',
'hqscripts',
'casexml.apps.case',
'corehq.apps.casegroups',
'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.domain',
'corehq.apps.domainsync',
'corehq.apps.domain_migration_flags',
'corehq.apps.dump_reload',
'corehq.apps.hqadmin',
'corehq.apps.hqcase',
'corehq.apps.hqwebapp',
'corehq.apps.hqmedia',
'corehq.apps.locations',
'corehq.apps.products',
'corehq.apps.prelogin',
'corehq.apps.programs',
'corehq.apps.commtrack',
'corehq.apps.consumption',
'corehq.apps.tzmigration',
'corehq.form_processor.app_config.FormProcessorAppConfig',
'corehq.sql_db',
'corehq.sql_accessors',
'corehq.sql_proxy_accessors',
'couchforms',
'couchexport',
'dimagi.utils',
'formtranslate',
'langcodes',
'corehq.apps.data_dictionary',
'corehq.apps.analytics',
'corehq.apps.callcenter',
'corehq.apps.change_feed',
'corehq.apps.crud',
'corehq.apps.custom_data_fields',
'corehq.apps.receiverwrapper',
'corehq.apps.repeaters',
'corehq.apps.app_manager',
'corehq.apps.es',
'corehq.apps.fixtures',
'corehq.apps.calendar_fixture',
'corehq.apps.case_importer',
'corehq.apps.reminders',
'corehq.apps.translations',
'corehq.apps.tour',
'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.smsbackends.tropo',
'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.apposit',
'corehq.messaging.smsbackends.test',
'corehq.apps.performance_sms',
'corehq.apps.registration',
'corehq.messaging.smsbackends.unicel',
'corehq.messaging.smsbackends.icds_nic',
'corehq.apps.reports',
'corehq.apps.reports_core',
'corehq.apps.userreports',
'corehq.apps.data_interfaces',
'corehq.apps.export',
'corehq.apps.builds',
'corehq.apps.api',
'corehq.apps.indicators',
'corehq.apps.notifications',
'corehq.apps.cachehq',
'corehq.apps.toggle_ui',
'corehq.apps.hqpillow_retry',
'corehq.couchapps',
'corehq.preindex',
'corehq.tabs',
'custom.apps.wisepill',
'custom.fri',
'custom.openclinica',
'fluff',
'fluff.fluff_filter',
'soil',
'toggle',
'touchforms.formplayer',
'phonelog',
'pillowtop',
'pillow_retry',
'corehq.apps.style',
'corehq.apps.styleguide',
'corehq.messaging.smsbackends.grapevine',
'corehq.apps.dashboard',
'corehq.util',
'dimagi.ext',
'corehq.doctypemigrations',
'corehq.blobs',
'corehq.apps.case_search',
'corehq.apps.zapier.apps.ZapierConfig',
# custom reports
'a5288',
'custom.bihar',
'custom.apps.gsid',
'hsph',
'mvp',
'mvp_docs',
'mvp_indicators',
'custom.opm',
'pact',
'custom.reports.mc',
'custom.apps.crs_reports',
'custom.hope',
'custom.logistics',
'custom.ilsgateway',
'custom.zipline',
'custom.ewsghana',
'custom.m4change',
'custom.succeed',
'custom.ucla',
'custom.uth',
'custom.intrahealth',
'custom.world_vision',
'custom.up_nrhm',
'custom.care_pathways',
'custom.common',
'custom.icds',
'custom.icds_reports',
'custom.pnlppgi',
)
ENIKSHAY_APPS = (
'custom.enikshay',
'custom.enikshay.integrations.ninetyninedots',
'custom.enikshay.nikshay_datamigration',
)
# DEPRECATED use LOCAL_APPS instead; can be removed with testrunner.py
TEST_APPS = ()
# also excludes any app starting with 'django.'
APPS_TO_EXCLUDE_FROM_TESTS = (
'a5288',
'captcha',
'couchdbkit.ext.django',
'corehq.apps.ivr',
'corehq.messaging.smsbackends.mach',
'corehq.messaging.smsbackends.http',
'corehq.apps.settings',
'corehq.messaging.smsbackends.megamobile',
'corehq.messaging.smsbackends.yo',
'corehq.messaging.smsbackends.smsgh',
'corehq.messaging.smsbackends.push',
'corehq.messaging.smsbackends.apposit',
'crispy_forms',
'django_extensions',
'django_prbac',
'django_otp',
'django_otp.plugins.otp_static',
'django_otp.plugins.otp_totp',
'djcelery',
'djtables',
'gunicorn',
'langcodes',
'raven.contrib.django.raven_compat',
'rosetta',
'two_factor',
'custom.apps.crs_reports',
'custom.m4change',
# submodules with tests that run on travis
'dimagi.utils',
)
INSTALLED_APPS = DEFAULT_APPS + HQ_APPS + ENIKSHAY_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)s/settings/project/internal_subscription_management/',
'/a/%(domain)s/settings/project/internal/info/',
'/a/%(domain)s/settings/project/internal/calculations/',
'/a/%(domain)s/settings/project/flags/'
)
####### 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 = "style/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
# Todo: Will require changing salt pillar and localsettings template
# Todo: or more likely in ansible once that's a thing
EMAIL_LOGIN = "user@domain.com"
EMAIL_PASSWORD = "changeme"
EMAIL_SMTP_HOST = "smtp.gmail.com"
EMAIL_SMTP_PORT = 587
# These are the normal Django settings
EMAIL_USE_TLS = True
# put email addresses here to have them receive bug reports
BUG_REPORT_RECIPIENTS = ()
EXCHANGE_NOTIFICATION_RECIPIENTS = []
# the physical server emailing - differentiate if needed
SERVER_EMAIL = 'commcarehq-noreply@dimagi.com'
DEFAULT_FROM_EMAIL = 'commcarehq-noreply@dimagi.com'
SUPPORT_EMAIL = "commcarehq-support@dimagi.com"
PROBONO_SUPPORT_EMAIL = 'pro-bono@dimagi.com'
CCHQ_BUG_REPORT_EMAIL = 'commcarehq-bug-reports@dimagi.com'
ACCOUNTS_EMAIL = 'accounts@dimagi.com'
DATA_EMAIL = 'datatree@dimagi.com'
SUBSCRIPTION_CHANGE_EMAIL = 'accounts+subchange@dimagi.com'
INTERNAL_SUBSCRIPTION_CHANGE_EMAIL = 'accounts+subchange+internal@dimagi.com'
BILLING_EMAIL = 'billing-comm@dimagi.com'
INVOICING_CONTACT_EMAIL = 'billing-support@dimagi.com'
MASTER_LIST_EMAIL = 'master-list@dimagi.com'
REPORT_BUILDER_ADD_ON_EMAIL = 'sales' + '@' + 'dimagi.com'
EULA_CHANGE_EMAIL = 'eula-notifications@dimagi.com'
CONTACT_EMAIL = 'info@dimagi.com'
BOOKKEEPER_CONTACT_EMAILS = []
SOFT_ASSERT_EMAIL = 'commcarehq-ops+soft_asserts@dimagi.com'
EMAIL_SUBJECT_PREFIX = '[commcarehq] '
SERVER_ENVIRONMENT = 'localdev'
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 = {
# fixtures that may be sent to the phone independent of cases
'standalone': [
# core
"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.calendar_fixture.fixture_provider.calendar_fixture_generator",
# custom
"custom.bihar.reports.indicators.fixtures.generator",
"custom.m4change.fixtures.report_fixtures.generator",
"custom.m4change.fixtures.location_fixtures.generator",
],
# fixtures that must be sent along with the phones cases
'case': [
"corehq.apps.locations.fixtures.location_fixture_generator",
"corehq.apps.locations.fixtures.flat_location_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 = 'django://' # default django db based
CELERY_ANNOTATIONS = {
'*': {
'on_failure': helper.celery_failure_handler,
'trail': False,
}
}
CELERY_MAIN_QUEUE = 'celery'
# this is the default celery queue
# for periodic tasks on a separate queue override this to something else
CELERY_PERIODIC_QUEUE = CELERY_MAIN_QUEUE
# This is the celery queue to use for running reminder rules.
# It's set to the main queue here and can be overridden to put it
# on its own queue.
CELERY_REMINDER_RULE_QUEUE = CELERY_MAIN_QUEUE
# This is the celery queue to use for running reminder case updates.
# It's set to the main queue here and can be overridden to put it
# on its own queue.
CELERY_REMINDER_CASE_UPDATE_QUEUE = CELERY_MAIN_QUEUE
# This is the celery queue to use for sending repeat records.
# It's set to the main queue here and can be overridden to put it
# on its own queue.
CELERY_REPEAT_RECORD_QUEUE = CELERY_MAIN_QUEUE
# Will cause a celery task to raise a SoftTimeLimitExceeded exception if
# time limit is exceeded.
CELERYD_TASK_SOFT_TIME_LIMIT = 86400 * 2 # 2 days in seconds
# 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"
XFORMS_PLAYER_URL = "http://localhost:4444/" # touchform's setting
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.
SMS_QUEUE_ENABLED = False
# If an SMS still has not been processed in this number of minutes, enqueue it
# again.
SMS_QUEUE_ENQUEUING_TIMEOUT = 60
# 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
# 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
####### Pillow Retry Queue Settings #######
# Setting this to False no pillowtop errors will get processed.
PILLOW_RETRY_QUEUE_ENABLED = False
# If an error still has not been processed in this number of minutes, enqueue it
# again.
PILLOW_RETRY_QUEUE_ENQUEUING_TIMEOUT = 60
# Number of minutes a celery task will alot for itself (via lock timeout)
PILLOW_RETRY_PROCESSING_LOCK_TIMEOUT = 5
# Number of minutes to wait before retrying an unsuccessful processing attempt
PILLOW_RETRY_REPROCESS_INTERVAL = 5
# Max number of processing attempts before giving up on processing the error
PILLOW_RETRY_QUEUE_MAX_PROCESSING_ATTEMPTS = 3
# The backoff factor by which to increase re-process intervals by.
# next_interval = PILLOW_RETRY_REPROCESS_INTERVAL * attempts^PILLOW_RETRY_BACKOFF_FACTOR
PILLOW_RETRY_BACKOFF_FACTOR = 2
# After an error's total attempts exceeds this number it will only be re-attempted
# once after being reset. This is to prevent numerous retries of errors that aren't
# getting fixed
PILLOW_RETRY_MULTI_ATTEMPTS_CUTOFF = PILLOW_RETRY_QUEUE_MAX_PROCESSING_ATTEMPTS * 3
####### 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.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': '',
}
ANALYTICS_CONFIG = {
"HQ_INSTANCE": '', # e.g. "www" or "staging"
}
MAPBOX_ACCESS_TOKEN = 'pk.eyJ1IjoiZGltYWdpIiwiYSI6ImpZWWQ4dkUifQ.3FNy5rVvLolWLycXPxKVEA'
OPEN_EXCHANGE_RATES_API_ID = ''
# for touchforms maps
GMAPS_API_KEY = "changeme"
# for touchforms authentication
TOUCHFORMS_API_USER = "changeme"
TOUCHFORMS_API_PASSWORD = "changeme"
# import local settings if we find them
LOCAL_APPS = ()
LOCAL_COUCHDB_APPS = ()
LOCAL_MIDDLEWARE_CLASSES = ()
LOCAL_PILLOWTOPS = {}
LOCAL_REPEATERS = ()
# Prelogin site
ENABLE_PRELOGIN_SITE = False
PRELOGIN_APPS = (
'corehq.apps.prelogin',
)
# our production logstash aggregation
LOGSTASH_DEVICELOG_PORT = 10777
LOGSTASH_AUDITCARE_PORT = 10999
LOGSTASH_HOST = 'localhost'
# on both a single instance or distributed setup this should assume localhost
ELASTICSEARCH_HOST = 'localhost'
ELASTICSEARCH_PORT = 9200
ELASTICSEARCH_VERSION = 1.7
####### Couch Config #######
# for production this ought to be set to true on your configured couch instance
COUCH_HTTPS = False
COUCH_SERVER_ROOT = 'localhost:5984' # 6984 for https couch
COUCH_USERNAME = ''
COUCH_PASSWORD = ''
COUCH_DATABASE_NAME = 'commcarehq'
BITLY_LOGIN = ''
BITLY_APIKEY = ''
# this should be overridden in localsettings
INTERNAL_DATA = defaultdict(list)
COUCH_STALE_QUERY = 'update_after' # 'ok' for cloudant
MESSAGE_LOG_OPTIONS = {
"abbreviated_phone_number_domains": ["mustmgh", "mgh-cgh-uganda"],
}
IVR_OUTBOUND_RETRIES = 3
IVR_OUTBOUND_RETRY_INTERVAL = 10
PREVIEWER_RE = '^$'
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
DIGEST_LOGIN_FACTORY = 'django_digest.NoEmailLoginFactory'
# Django Compressor
COMPRESS_PRECOMPILERS = (
('text/less', 'corehq.apps.style.precompilers.LessFilter'),
)
COMPRESS_ENABLED = True
COMPRESS_JS_COMPRESSOR = 'corehq.apps.style.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': '../../../style/less/_hq/includes/variables',
'mixins': '../../../style/less/_hq/includes/mixins',
}
LESS_FOR_BOOTSTRAP_3_BINARY = '/opt/lessc/bin/lessc'
# 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 = ''
SQL_REPORTING_DATABASE_URL = None
UCR_DATABASE_URL = None
# Override this in localsettings to specify custom reporting databases
CUSTOM_DATABASES = {}
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
ENVIRONMENT_HOSTS = {
'pillowtop': ['localhost']
}
DATADOG_API_KEY = None
DATADOG_APP_KEY = None
# Override with the PEM export of an RSA private key, for use with any
# encryption or signing workflows.
HQ_PRIVATE_KEY = None
# Settings for Zipline integration
ZIPLINE_API_URL = ''
ZIPLINE_API_USER = ''
ZIPLINE_API_PASSWORD = ''
KAFKA_URL = 'localhost:9092'
MOBILE_INTEGRATION_TEST_TOKEN = None
OVERRIDE_UCR_BACKEND = None
ENTERPRISE_MODE = False
CUSTOM_LANDING_PAGE = False
TABLEAU_URL_ROOT = "https://icds.commcarehq.org/"
ONBOARDING_DOMAIN_TEST_DATE = ()
HQ_INSTANCE = 'development'
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 error.message != 'No module named localsettings':
raise error
# fallback in case nothing else is found - used for readthedocs
from dev_settings import *
_location = lambda x: os.path.join(FILEPATH, x)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
_location('corehq/apps/domain/templates/login_and_password'),
],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'corehq.util.context_processors.base_template',
'corehq.util.context_processors.current_url_name',
'corehq.util.context_processors.domain',
'corehq.util.context_processors.enterprise_mode',
'corehq.util.context_processors.js_api_keys',
'corehq.util.context_processors.websockets_override',
],
'debug': DEBUG,
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
],
},
},
]
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(asctime)s %(levelname)s %(message)s'
},
'pillowtop': {
'format': '%(asctime)s %(levelname)s %(module)s %(message)s'
},
'couch-request-formatter': {
'format': '%(asctime)s [%(username)s:%(domain)s] %(hq_url)s %(method)s %(status_code)s %(content_length)s %(path)s %(duration)s'
},
'datadog': {
'format': '%(metric)s %(created)s %(value)s metric_type=%(metric_type)s %(message)s'
},
'ucr_timing': {
'format': '%(asctime)s\t%(domain)s\t%(report_config_id)s\t%(filter_values)s\t%(control_duration)s\t%(candidate_duration)s'
},
'ucr_diff': {
'format': '%(asctime)s\t%(domain)s\t%(report_config_id)s\t%(filter_values)s\t%(control)s\t%(diff)s'
},
'ucr_exception': {
'format': '%(asctime)s\t%(domain)s\t%(report_config_id)s\t%(filter_values)s\t%(candidate)s'
},
},
'filters': {
'hqcontext': {
'()': 'corehq.util.log.HQRequestFilter',
},
},
'handlers': {
'pillowtop': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'pillowtop'
},
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
'file': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'verbose',
'filename': DJANGO_LOG_FILE,
'maxBytes': 10 * 1024 * 1024, # 10 MB
'backupCount': 20 # Backup 200 MB of logs
},
'couch-request-handler': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'couch-request-formatter',
'filters': ['hqcontext'],
'filename': COUCH_LOG_FILE,
'maxBytes': 10 * 1024 * 1024, # 10 MB
'backupCount': 20 # Backup 200 MB of logs
},
'accountinglog': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'verbose',