forked from openedx/openedx-platform
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcommon.py
More file actions
1323 lines (1036 loc) · 48.1 KB
/
common.py
File metadata and controls
1323 lines (1036 loc) · 48.1 KB
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
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change the feature
configuration in an environment specific config file and re-calculate those
values.
We should make a method that calls all these config methods so that you just
make one call at the end of your site-specific dev file to reset all the
dependent variables (like INSTALLED_APPS) for you.
Longer TODO:
1. Right now our treatment of static content in general and in particular
course-specific static content is haphazard.
2. We should have a more disciplined approach to feature flagging, even if it
just means that we stick them in a dict called FEATURES.
3. We need to handle configuration for multiple courses. This could be as
multiple sites, but we do need a way to map their data assets.
When refering to XBlocks, we use the entry-point name. For example,
| setup(
| name='xblock-foobar',
| version='0.1',
| packages=[
| 'foobar_xblock',
| ],
| entry_points={
| 'xblock.v1': [
| 'foobar-block = foobar_xblock:FoobarBlock',
| # ^^^^^^^^^^^^ This is the one you want.
| ]
| },
| )
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=unused-import, useless-suppression, wrong-import-order, wrong-import-position
import importlib.util
import os
from corsheaders.defaults import default_headers as corsheaders_default_headers
from datetime import timedelta
from django.utils.translation import gettext_lazy as _
from openedx_content.settings_api import openedx_content_backcompat_apps_to_install
from openedx.envs.common import * # pylint: disable=wildcard-import
from path import Path as path
from cms.lib.xblock.authoring_mixin import AuthoringMixin
from cms.lib.xblock.upstream_sync import UpstreamSyncMixin
from xmodule.x_module import ResourceTemplates
from openedx.core.lib.derived import Derived
from openedx.core.lib.features_setting_proxy import FeaturesProxy
# A proxy for feature flags stored in the settings namespace
FEATURES = FeaturesProxy(globals())
# pylint: enable=useless-suppression
############################ FEATURE CONFIGURATION #############################
CONTACT_MAILING_ADDRESS = _('Your Contact Mailing Address Here')
# Dummy secret key for dev/test
SECRET_KEY = 'dev key'
STUDIO_NAME = _("Your Platform Studio")
STUDIO_SHORT_NAME = _("Studio")
# FEATURES
GITHUB_PUSH = False
# email address for studio staff (eg to request course creation)
STUDIO_REQUEST_EMAIL = ''
# Segment - must explicitly turn it on for production
CMS_SEGMENT_KEY = None
# If set to True, new Studio users won't be able to author courses unless
# an Open edX admin has added them to the course creator group.
ENABLE_CREATOR_GROUP = True
# If set to True, organization staff members can create libraries for their specific
# organization and no other organizations. They do not need to be course creators,
# even when ENABLE_CREATOR_GROUP is True.
ENABLE_ORGANIZATION_STAFF_ACCESS_FOR_CONTENT_LIBRARIES = True
# Turn off account locking if failed login attempts exceeds a limit
ENABLE_MAX_FAILED_LOGIN_ATTEMPTS = False
# .. toggle_name: settings.EDITABLE_SHORT_DESCRIPTION
# .. toggle_implementation: DjangoSetting
# .. toggle_default: True
# .. toggle_description: This feature flag allows editing of short descriptions on the Schedule & Details page in
# Open edX Studio. Set to False if you want to disable the editing of the course short description.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2014-02-13
# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/2334
EDITABLE_SHORT_DESCRIPTION = True
# Hide any Personally Identifiable Information from application logs
SQUELCH_PII_IN_LOGS = False
# Allow creating courses with non-ascii characters in the course id
ALLOW_UNICODE_COURSE_ID = False
# Prevent concurrent logins per user
PREVENT_CONCURRENT_LOGINS = False
# Turn off Video Upload Pipeline through Studio, by default
ENABLE_VIDEO_UPLOAD_PIPELINE = False
# Show a new field in "Advanced settings" that can store custom data about a
# course and that can be read from themes
ENABLE_OTHER_COURSE_SETTINGS = False
# Enable support for content libraries. Note that content libraries are
# only supported in courses using split mongo.
ENABLE_CONTENT_LIBRARIES = True
# .. toggle_name: settings.ENABLE_CONTENT_LIBRARIES_LTI_TOOL
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: When set to True, Content Libraries in
# Studio can be used as an LTI 1.3 tool by external LTI platforms.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2021-08-17
# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/27411
ENABLE_CONTENT_LIBRARIES_LTI_TOOL = False
# Toggle course entrance exams feature
ENTRANCE_EXAMS = False
# Enable the courseware search functionality
ENABLE_COURSEWARE_INDEX = False
# Enable content libraries (modulestore) search functionality
ENABLE_LIBRARY_INDEX = False
# .. toggle_name: settings.ALLOW_COURSE_RERUNS
# .. toggle_implementation: DjangoSetting
# .. toggle_default: True
# .. toggle_description: This will allow staff member to re-run the course from the studio home page and will
# always use the split modulestore. When this is set to False, the Re-run Course link will not be available on
# the studio home page.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2015-02-13
# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/6965
ALLOW_COURSE_RERUNS = True
# Whether archived courses (courses with end dates in the past) should be
# shown in Studio in a separate list.
ENABLE_SEPARATE_ARCHIVED_COURSES = True
ENABLE_GRADE_DOWNLOADS = True
ENABLE_DISCUSSION_HOME_PANEL = True
ENABLE_COUNTRY_ACCESS = False
ENABLE_CREDIT_API = False
### ORA Feature Flags ###
# .. toggle_name: settings.DEPRECATE_OLD_COURSE_KEYS_IN_STUDIO
# .. toggle_implementation: DjangoSetting
# .. toggle_default: True
# .. toggle_description: Warn about removing support for deprecated course keys.
# To enable, set to True.
# To disable, set to False.
# To enable with a custom support deadline, set to an ISO-8601 date string:
# eg: '2020-09-01'
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2020-06-12
# .. toggle_target_removal_date: 2021-04-01
# .. toggle_warning: This can be removed once support is removed for deprecated
# course keys.
# .. toggle_tickets: https://openedx.atlassian.net/browse/DEPR-58
DEPRECATE_OLD_COURSE_KEYS_IN_STUDIO = True
# .. toggle_name: settings.DISABLE_COURSE_CREATION
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: If set to True, it disables the course creation functionality and hides the "New Course"
# button in studio.
# It is important to note that the value of this flag only affects if the user doesn't have a staff role,
# otherwise the course creation functionality will work as it should.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2013-12-02
# .. toggle_warning: Another toggle DISABLE_LIBRARY_CREATION overrides DISABLE_COURSE_CREATION, if present.
DISABLE_COURSE_CREATION = False
# .. toggle_name: settings.ENABLE_LTI_PII_ACKNOWLEDGEMENT
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Enables the lti pii acknowledgement feature for a course
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2023-10
# .. toggle_target_removal_date: None
# .. toggle_tickets: 'https://2u-internal.atlassian.net/browse/MST-2055'
ENABLE_LTI_PII_ACKNOWLEDGEMENT = False
# .. toggle_name: settings.DISABLE_ADVANCED_SETTINGS
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Set to `True` to disable the advanced settings page in Studio for all users except those
# having `is_superuser` or `is_staff` set to `True`.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2023-03-31
# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/32015
DISABLE_ADVANCED_SETTINGS = False
# .. toggle_name: settings.ENABLE_SEND_XBLOCK_LIFECYCLE_EVENTS_OVER_BUS
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Enables sending xblock lifecycle events over the event bus. Used to create the
# EVENT_BUS_PRODUCER_CONFIG setting
# .. toggle_use_cases: opt_in
# .. toggle_creation_date: 2023-10-10
# .. toggle_target_removal_date: 2023-10-12
# .. toggle_warning: The default may be changed in a later release. See
# https://github.com/openedx/openedx-events/issues/265
# .. toggle_tickets: https://github.com/edx/edx-arch-experiments/issues/381
ENABLE_SEND_XBLOCK_LIFECYCLE_EVENTS_OVER_BUS = False
# .. toggle_name: settings.ENABLE_HIDE_FROM_TOC_UI
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: When enabled, exposes hide_from_toc xblock attribute so course authors can configure it as
# a section visibility option in Studio.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2024-02-29
# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/33952
ENABLE_HIDE_FROM_TOC_UI = False
# .. toggle_name: settings.IN_CONTEXT_DISCUSSION_ENABLED_DEFAULT
# .. toggle_implementation: DjangoSetting
# .. toggle_default: True
# .. toggle_description: Set to False to disable in-context discussion for units by default.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2024-09-02
IN_CONTEXT_DISCUSSION_ENABLED_DEFAULT = True
# .. toggle_name: ENABLE_COPPA_COMPLIANCE
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: When True, inforces COPPA compliance and removes YOB field from registration form and accounnt
# .. settings page. Also hide YOB banner from profile page.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2021-10-27
# .. toggle_tickets: 'https://openedx.atlassian.net/browse/VAN-622'
ENABLE_COPPA_COMPLIANCE = False
ENABLE_JASMINE = False
MARKETING_EMAILS_OPT_IN = False
############################# MICROFRONTENDS ###################################
COURSE_AUTHORING_MICROFRONTEND_URL = None
############################# SET PATH INFORMATION #############################
PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /edx-platform/cms
CMS_ROOT = REPO_ROOT / "cms"
LMS_ROOT = REPO_ROOT / "lms"
GITHUB_REPO_ROOT = ENV_ROOT / "data"
######################## BRANCH.IO ###########################
BRANCH_IO_KEY = ''
######################## HOTJAR ###########################
HOTJAR_ID = 00000
############################# TEMPLATE CONFIGURATION #############################
MAKO_TEMPLATE_DIRS_BASE.insert(3, COMMON_ROOT / 'static')
MAKO_TEMPLATE_DIRS_BASE.append(CMS_ROOT / 'djangoapps' / 'pipeline_js' / 'templates')
MAKO_TEMPLATE_DIRS_BASE.append(XMODULE_ROOT / 'capa' / 'templates')
def make_lms_template_path(settings):
"""
Make the path for the LMS "templates" dir
"""
templates_path = settings.PROJECT_ROOT / 'templates'
return templates_path.replace('cms', 'lms')
lms_mako_template_dirs_base[0] = Derived(make_lms_template_path)
TEMPLATES[0]['DIRS'] = Derived(make_mako_template_dirs)
TEMPLATES.append(
{
# This separate copy of the Mako backend is used to render previews using the LMS templates
'NAME': 'preview',
'BACKEND': 'common.djangoapps.edxmako.backend.Mako',
'APP_DIRS': False,
'DIRS': lms_mako_template_dirs_base,
'OPTIONS': {
'context_processors': CONTEXT_PROCESSORS,
'debug': False,
'namespace': 'lms.main',
}
}
)
#################################### AWS #######################################
AWS_SECURITY_TOKEN = None
##############################################################################
# use the ratelimit backend to prevent brute force attacks
AUTHENTICATION_BACKENDS.insert(0, 'auth_backends.backends.EdXOAuth2')
AUTHENTICATION_BACKENDS.insert(2, 'openedx.core.djangoapps.content_libraries.auth.LtiAuthenticationBackend')
LMS_BASE = None
# Use LMS SSO for login, once enabled by setting LOGIN_URL (see docs/guides/studio_oauth.rst)
SOCIAL_AUTH_STRATEGY = 'auth_backends.strategies.EdxDjangoStrategy'
LOGIN_REDIRECT_URL = EDX_ROOT_URL + '/home/'
LOGIN_URL = '/login/'
FRONTEND_LOGIN_URL = LOGIN_URL
# Warning: Must have trailing slash to activate correct logout view
# (auth_backends, not LMS user_authn)
FRONTEND_LOGOUT_URL = '/logout/'
FRONTEND_REGISTER_URL = Derived(lambda settings: settings.LMS_ROOT_URL + '/register')
ENTERPRISE_API_URL = Derived(lambda settings: settings.LMS_INTERNAL_ROOT_URL + '/enterprise/api/v1/')
ENTERPRISE_CONSENT_API_URL = Derived(lambda settings: settings.LMS_INTERNAL_ROOT_URL + '/consent/api/v1/')
# Public domain name of Studio (should be resolvable from the end-user's browser)
CMS_BASE = None
CMS_ROOT_URL = None
MAINTENANCE_BANNER_TEXT = 'Sample banner message'
CERT_QUEUE = 'certificates'
################################# Middleware ###################################
MIDDLEWARE = [
'openedx.core.lib.x_forwarded_for.middleware.XForwardedForMiddleware',
'edx_django_utils.security.csp.middleware.content_security_policy_middleware',
'crum.CurrentRequestUserMiddleware',
# Resets the request cache.
'edx_django_utils.cache.middleware.RequestCacheMiddleware',
# Various monitoring middleware
'edx_django_utils.monitoring.CookieMonitoringMiddleware',
'edx_django_utils.monitoring.DeploymentMonitoringMiddleware',
'edx_django_utils.monitoring.FrontendMonitoringMiddleware',
'edx_django_utils.monitoring.MonitoringMemoryMiddleware',
'openedx.core.djangoapps.header_control.middleware.HeaderControlMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware',
# CORS and CSRF
'django.middleware.csrf.CsrfViewMiddleware',
'corsheaders.middleware.CorsMiddleware',
'openedx.core.djangoapps.cors_csrf.middleware.CorsCSRFMiddleware',
'openedx.core.djangoapps.cors_csrf.middleware.CsrfCrossDomainCookieMiddleware',
# JWT auth
'edx_rest_framework_extensions.auth.jwt.middleware.JwtAuthCookieMiddleware',
# Allows us to define redirects via Django admin
'django_sites_extensions.middleware.RedirectMiddleware',
# Instead of SessionMiddleware, we use a more secure version
# 'django.contrib.sessions.middleware.SessionMiddleware',
'openedx.core.djangoapps.safe_sessions.middleware.SafeSessionMiddleware',
'method_override.middleware.MethodOverrideMiddleware',
# Instead of AuthenticationMiddleware, we use a cache-backed version
'openedx.core.djangoapps.cache_toolbox.middleware.CacheBackedAuthenticationMiddleware',
'common.djangoapps.student.middleware.UserStandingMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'common.djangoapps.track.middleware.TrackMiddleware',
# This is used to set or update the user language preferences.
'openedx.core.djangoapps.lang_pref.middleware.LanguagePreferenceMiddleware',
# Allows us to dark-launch particular languages
'openedx.core.djangoapps.dark_lang.middleware.DarkLangMiddleware',
'openedx.core.djangoapps.embargo.middleware.EmbargoMiddleware',
# Detects user-requested locale from 'accept-language' header in http request
'django.middleware.locale.LocaleMiddleware',
'codejail.django_integration.ConfigureCodeJailMiddleware',
# for expiring inactive sessions
'openedx.core.djangoapps.session_inactivity_timeout.middleware.SessionInactivityTimeout',
'openedx.core.djangoapps.theming.middleware.CurrentSiteThemeMiddleware',
# use Django built in clickjacking protection
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'waffle.middleware.WaffleMiddleware',
# Enables force_django_cache_miss functionality for TieredCache.
'edx_django_utils.cache.middleware.TieredCacheMiddleware',
# Adds monitoring attributes to requests.
'edx_rest_framework_extensions.middleware.RequestCustomAttributesMiddleware',
'edx_rest_framework_extensions.auth.jwt.middleware.EnsureJWTAuthSettingsMiddleware',
# Handles automatically storing user ids in django-simple-history tables when possible.
'simple_history.middleware.HistoryRequestMiddleware',
# This must be last so that it runs first in the process_response chain
'openedx.core.djangoapps.site_configuration.middleware.SessionCookieDomainOverrideMiddleware',
]
EXTRA_MIDDLEWARE_CLASSES = []
############# XBlock Configuration ##########
# DO NOT EXPAND THIS LIST!! See declaration in openedx/envs/common.py for more information
mixins = list(XBLOCK_MIXINS)
mixins.insert(2, ResourceTemplates)
mixins += [
UpstreamSyncMixin, # Should be above AuthoringMixin for UpstreamSyncMixin.editor_saved to take effect
AuthoringMixin,
]
XBLOCK_MIXINS = tuple(mixins)
############################ ORA 2 ############################################
# By default, don't use a file prefix
ORA2_FILE_PREFIX = 'default_env-default_deployment/ora2'
############################ Modulestore Configuration ################################
CONTENTSTORE['DOC_STORE_CONFIG']['read_preference'] = 'PRIMARY'
MODULESTORE_BRANCH = 'draft-preferred'
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
#################### Python sandbox ############################################
# Needs to be non-zero so that jailed code can use it as their temp directory.(1MiB in bytes)
CODE_JAIL['limits']['FSIZE'] = 1048576
############################ DJANGO_BUILTINS ################################
COURSE_IMPORT_EXPORT_BUCKET = ''
COURSE_METADATA_EXPORT_BUCKET = ''
ALTERNATE_WORKER_QUEUES = 'lms'
# .. setting_name: GIT_REPO_EXPORT_DIR
# .. setting_default: '/edx/var/edxapp/export_course_repos'
# .. setting_description: When courses are exported to git, either with the export_git management command or the git
# export view from the studio (when settings.ENABLE_EXPORT_GIT is True), they are stored in this directory, which
# must exist at the time of the export.
GIT_REPO_EXPORT_DIR = '/edx/var/edxapp/export_course_repos'
# .. setting_name: GIT_EXPORT_DEFAULT_IDENT
# .. setting_default: {'name': 'STUDIO_EXPORT_TO_GIT', 'email': '[email protected]'}
# .. setting_description: When courses are exported to git, commits are signed with this name/email git identity.
GIT_EXPORT_DEFAULT_IDENT = {
'name': 'STUDIO_EXPORT_TO_GIT',
'email': '[email protected]'
}
# Email
TECH_SUPPORT_EMAIL = '[email protected]'
EMAIL_FILE_PATH = Derived(lambda settings: path(settings.DATA_DIR) / "emails" / "studio")
DEFAULT_FROM_EMAIL = '[email protected]'
DEFAULT_FEEDBACK_EMAIL = '[email protected]'
TECH_SUPPORT_EMAIL = '[email protected]'
CONTACT_EMAIL = '[email protected]'
BUGS_EMAIL = '[email protected]'
SERVER_EMAIL = '[email protected]'
UNIVERSITY_EMAIL = '[email protected]'
PRESS_EMAIL = '[email protected]'
# Static content
STATIC_URL = '/static/studio/'
STATIC_ROOT = os.environ.get('STATIC_ROOT_CMS', ENV_ROOT / 'staticfiles' / 'studio')
# Storage
COURSE_IMPORT_EXPORT_STORAGE = 'django.core.files.storage.FileSystemStorage'
COURSE_METADATA_EXPORT_STORAGE = 'django.core.files.storage.FileSystemStorage'
##### custom vendor plugin variables #####
############################### PIPELINE #######################################
PIPELINE.update({
'JS_COMPRESSOR': None,
'COMPILERS': (),
'YUI_BINARY': 'yui-compressor',
})
PIPELINE['STYLESHEETS'] = {
'style-vendor': {
'source_filenames': [
'css/vendor/normalize.css',
'css/vendor/font-awesome.css',
'css/vendor/html5-input-polyfills/number-polyfill.css',
'js/vendor/CodeMirror/codemirror.css',
'css/vendor/ui-lightness/jquery-ui-1.8.22.custom.css',
'css/vendor/jquery.qtip.min.css',
'js/vendor/markitup/skins/simple/style.css',
'js/vendor/markitup/sets/wiki/style.css',
],
'output_filename': 'css/cms-style-vendor.css',
},
'style-vendor-tinymce-content': {
'source_filenames': [
'css/tinymce-studio-content-fonts.css',
'js/vendor/tinymce/js/tinymce/skins/ui/studio-tmce5/content.min.css',
'css/tinymce-studio-content.css'
],
'output_filename': 'css/cms-style-vendor-tinymce-content.css',
},
'style-vendor-tinymce-skin': {
'source_filenames': [
'js/vendor/tinymce/js/tinymce/skins/ui/studio-tmce5/skin.min.css'
],
'output_filename': 'css/cms-style-vendor-tinymce-skin.css',
},
'style-main-v1': {
'source_filenames': [
'css/studio-main-v1.css',
],
'output_filename': 'css/studio-main-v1.css',
},
'style-main-v1-rtl': {
'source_filenames': [
'css/studio-main-v1-rtl.css',
],
'output_filename': 'css/studio-main-v1-rtl.css',
},
'style-xmodule-annotations': {
'source_filenames': [
'css/vendor/ova/annotator.css',
'css/vendor/ova/edx-annotator.css',
'css/vendor/ova/video-js.min.css',
'css/vendor/ova/rangeslider.css',
'css/vendor/ova/share-annotator.css',
'css/vendor/ova/richText-annotator.css',
'css/vendor/ova/tags-annotator.css',
'css/vendor/ova/flagging-annotator.css',
'css/vendor/ova/diacritic-annotator.css',
'css/vendor/ova/grouping-annotator.css',
'css/vendor/ova/ova.css',
'js/vendor/ova/catch/css/main.css'
],
'output_filename': 'css/cms-style-xmodule-annotations.css',
},
'course-unit-mfe-iframe-bundle': {
'source_filenames': [
'css/course-unit-mfe-iframe-bundle.css',
],
'output_filename': 'css/course-unit-mfe-iframe-bundle.css',
},
}
base_vendor_js = [
'js/src/utility.js',
'js/src/logger.js',
'common/js/vendor/jquery.js',
'common/js/vendor/jquery-migrate.js',
'js/vendor/jquery.cookie.js',
'js/vendor/url.min.js',
'common/js/vendor/underscore.js',
'common/js/vendor/underscore.string.js',
'common/js/vendor/backbone.js',
'js/vendor/URI.min.js',
# Make some edX UI Toolkit utilities available in the global "edx" namespace
'edx-ui-toolkit/js/utils/global-loader.js',
'edx-ui-toolkit/js/utils/string-utils.js',
'edx-ui-toolkit/js/utils/html-utils.js',
# Here we were loading Bootstrap and supporting libraries, but it no longer seems to be needed for any Studio UI.
# 'common/js/vendor/bootstrap.bundle.js',
# Finally load RequireJS
'common/js/vendor/require.js'
]
# test_order: Determines the position of this chunk of javascript on
# the jasmine test page
PIPELINE['JAVASCRIPT'] = {
'base_vendor': {
'source_filenames': base_vendor_js,
'output_filename': 'js/cms-base-vendor.js',
},
}
STATICFILES_IGNORE_PATTERNS.append("common_static")
################################# DJANGO-REQUIRE ###############################
# The name of the require.js script used by your project, relative to REQUIRE_BASE_URL.
REQUIRE_JS = "js/vendor/requiresjs/require.js"
############################ SERVICE_VARIANT ##################################
SERVICE_VARIANT = 'cms'
################################# CELERY ######################################
# Name the exchange and queues w.r.t the SERVICE_VARIANT
HIGH_PRIORITY_QUEUE = f'edx.{SERVICE_VARIANT}.core.high'
DEFAULT_PRIORITY_QUEUE = f'edx.{SERVICE_VARIANT}.core.default'
LOW_PRIORITY_QUEUE = f'edx.{SERVICE_VARIANT}.core.low'
CELERY_QUEUES = {
HIGH_PRIORITY_QUEUE: {},
DEFAULT_PRIORITY_QUEUE: {},
LOW_PRIORITY_QUEUE: {},
}
CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION = True
CELERY_ALWAYS_EAGER = False
BROKER_USE_SSL = Derived(lambda settings: settings.CELERY_BROKER_USE_SSL)
############################## Video ##########################################
# Additional languages that should be supported for video transcripts, not included in ALL_LANGUAGES
EXTENDED_VIDEO_TRANSCRIPT_LANGUAGES = []
############################# SETTINGS FOR VIDEO UPLOAD PIPELINE #############################
VIDEO_UPLOAD_PIPELINE['CONCURRENT_UPLOAD_LIMIT'] = 4
############################ APPS #####################################
# The order of INSTALLED_APPS is important, when adding new apps here
# remember to check that you are not creating new
# RemovedInDjango19Warnings in the test logs.
INSTALLED_APPS = [
# Standard apps
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.redirects',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
# Tweaked version of django.contrib.staticfiles
'openedx.core.djangoapps.staticfiles.apps.EdxPlatformStaticFilesConfig',
'django_celery_results',
'method_override',
# Common Initialization
'openedx.core.djangoapps.common_initialization.apps.CommonInitializationConfig',
# Common views
'openedx.core.djangoapps.common_views',
# API access administration
'openedx.core.djangoapps.api_admin',
# CORS and cross-domain CSRF
'corsheaders',
'openedx.core.djangoapps.cors_csrf',
# Provides the 'django_markup' template library so we can use 'interpolate_html' in django templates
'xss_utils',
# History tables
'simple_history',
# Database-backed configuration
'config_models',
'openedx.core.djangoapps.config_model_utils',
'waffle',
# Monitor the status of services
'openedx.core.djangoapps.service_status',
# Video block configs (This will be moved to Video once it becomes an XBlock)
'openedx.core.djangoapps.video_config',
# edX Video Pipeline integration
'openedx.core.djangoapps.video_pipeline',
# For CMS
'cms.djangoapps.contentstore.apps.ContentstoreConfig',
'common.djangoapps.split_modulestore_django.apps.SplitModulestoreDjangoBackendAppConfig',
'openedx.core.djangoapps.contentserver',
'cms.djangoapps.course_creators',
'common.djangoapps.student.apps.StudentConfig', # misleading name due to sharing with lms
'openedx.core.djangoapps.course_groups', # not used in cms (yet), but tests run
'cms.djangoapps.xblock_config.apps.XBlockConfig',
'cms.djangoapps.export_course_metadata.apps.ExportCourseMetadataConfig',
'cms.djangoapps.modulestore_migrator',
# New (openedx_content-based) XBlock runtime
'openedx.core.djangoapps.xblock.apps.StudioXBlockAppConfig',
'openedx.core.djangoapps.util.apps.UtilConfig',
# Tracking
'common.djangoapps.track',
'eventtracking.django.apps.EventTrackingConfig',
# For asset pipelining
'common.djangoapps.edxmako.apps.EdxMakoConfig',
'pipeline',
'common.djangoapps.static_replace',
'require',
'webpack_loader',
# Site configuration for theming and behavioral modification
'openedx.core.djangoapps.site_configuration',
# Ability to detect and special-case crawler behavior
'openedx.core.djangoapps.crawlers',
# Discussion
'openedx.core.djangoapps.django_comment_common',
# Notifications
'openedx.core.djangoapps.notifications',
# for course creator table
'django.contrib.admin',
# for managing course modes
'common.djangoapps.course_modes.apps.CourseModesConfig',
# Verified Track Content Cohorting (Beta feature that will hopefully be removed)
'openedx.core.djangoapps.verified_track_content',
# Dark-launching languages
'openedx.core.djangoapps.dark_lang',
#
# User preferences
'wiki',
'django_notify',
'lms.djangoapps.course_wiki', # Our customizations
'mptt',
'sekizai',
'openedx.core.djangoapps.user_api',
# Country embargo support
'openedx.core.djangoapps.embargo',
# Course action state
'common.djangoapps.course_action_state',
'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig',
'openedx.core.djangoapps.content.block_structure.apps.BlockStructureConfig',
# edx-milestones service
'milestones',
# Credit courses
'openedx.core.djangoapps.credit.apps.CreditConfig',
'common.djangoapps.xblock_django',
# Catalog integration
'openedx.core.djangoapps.catalog',
# Programs support
'openedx.core.djangoapps.programs.apps.ProgramsConfig',
# django-oauth-toolkit
'oauth2_provider',
# These are apps that aren't strictly needed by Studio, but are imported by
# other apps that are. Django 1.8 wants to have imported models supported
# by installed apps.
'openedx.core.djangoapps.oauth_dispatch.apps.OAuthDispatchAppConfig',
'lms.djangoapps.courseware',
'lms.djangoapps.coursewarehistoryextended',
'lms.djangoapps.survey.apps.SurveyConfig',
'lms.djangoapps.verify_student.apps.VerifyStudentConfig',
'completion',
# System Wide Roles
'openedx.core.djangoapps.system_wide_roles',
# Static i18n support
'statici18n',
# Tagging
'cms.lib.xblock.tagging',
# Enables default site and redirects
'django_sites_extensions',
# additional release utilities to ease automation
'release_util',
# rule-based authorization
'rules.apps.AutodiscoverRulesConfig',
'bridgekeeper',
# management of user-triggered async tasks (course import/export, etc.)
'user_tasks',
# CMS specific user task handling
'cms.djangoapps.cms_user_tasks.apps.CmsUserTasksConfig',
# Unusual migrations
'common.djangoapps.database_fixups',
# Customized celery tasks, including persisting failed tasks so they can
# be retried
'celery_utils',
# Waffle related utilities
'openedx.core.djangoapps.waffle_utils',
# DRF filters
'django_filters',
'cms.djangoapps.api',
# edx-drf-extensions
'csrf.apps.CsrfAppConfig', # Enables frontend apps to retrieve CSRF tokens.
# Entitlements, used in openedx tests
'common.djangoapps.entitlements',
# Asset management for mako templates
'common.djangoapps.pipeline_mako',
# API Documentation
'drf_yasg',
# Tagging
'openedx_tagging',
'openedx.core.djangoapps.content_tagging',
# Search
'openedx.core.djangoapps.content.search',
# For Programs API
'lms.djangoapps.program_enrollments',
'openedx.features.course_duration_limits',
'openedx.features.content_type_gating',
'openedx.features.discounts',
'openedx.features.effort_estimation',
'lms.djangoapps.experiments',
'openedx.core.djangoapps.external_user_ids',
# so sample_task is available to celery workers
'openedx.core.djangoapps.heartbeat',
# signal handlers to capture course dates into edx-when
'openedx.core.djangoapps.course_date_signals',
# Management of per-user schedules
'openedx.core.djangoapps.schedules',
'rest_framework_jwt',
# Learning Sequence Navigation
'openedx.core.djangoapps.content.learning_sequences.apps.LearningSequencesConfig',
# Database-backed Organizations App (http://github.com/openedx/edx-organizations)
'organizations',
# User and group management via edx-django-utils
'edx_django_utils.user',
# Allow Studio to use LMS for SSO
'social_django',
# Content Library LTI 1.3 Support.
'pylti1p3.contrib.django.lti1p3_tool_config',
# For edx ace template tags
'edx_ace',
# alternative swagger generator for CMS API
'drf_spectacular',
'openedx_events',
# Core models to represent courses
"openedx_catalog",
# Core apps that power libraries
"openedx_content",
*openedx_content_backcompat_apps_to_install(),
]
### Apps only installed in some instances
add_optional_apps(OPTIONAL_APPS, INSTALLED_APPS)
##### ACCOUNT LOCKOUT DEFAULT PARAMETERS #####
MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED = 6
MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = 30 * 60
### Size of chunks into which asset uploads will be divided
UPLOAD_CHUNK_SIZE_IN_MB = 10
### Max size of asset uploads to GridFS
MAX_ASSET_UPLOAD_FILE_SIZE_IN_MB = 20
# FAQ url to direct users to if they upload
# a file that exceeds the above size
MAX_ASSET_UPLOAD_FILE_SIZE_URL = ""
### Default language for a new course
DEFAULT_COURSE_LANGUAGE = "en"
# Specify XBlocks that should be treated as advanced problems. Each entry is a
# dict:
# 'component': the entry-point name of the XBlock.
# 'boilerplate_name': an optional YAML template to be used. Specify as
# None to omit.
#
ADVANCED_PROBLEM_TYPES = [
{
'component': 'drag-and-drop-v2',
'boilerplate_name': None
},
{
'component': 'staffgradedxblock',
'boilerplate_name': None
}
]
LIBRARY_BLOCK_TYPES = [
{
'component': 'library_content',
'boilerplate_name': None
}
]
############### Settings for Retirement #####################
# See annotations in lms/envs/common.py for details.
RETIRED_USERNAME_FMT = Derived(lambda settings: settings.RETIRED_USERNAME_PREFIX + '{}')
# See annotations in lms/envs/common.py for details.
RETIRED_EMAIL_FMT = Derived(lambda settings: settings.RETIRED_EMAIL_PREFIX + '{}@' + settings.RETIRED_EMAIL_DOMAIN)
# See annotations in lms/envs/common.py for details.
RETIRED_USER_SALTS = ['abc', '123']
# See annotations in lms/envs/common.py for details.
RETIREMENT_SERVICE_WORKER_USERNAME = 'RETIREMENT_SERVICE_USER'
# Files and Uploads type filter values
FILES_AND_UPLOAD_TYPE_FILTERS = {
"Images": ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/tiff', 'image/tif', 'image/x-icon',
'image/svg+xml', 'image/bmp', 'image/x-ms-bmp', ],
"Documents": [
'application/pdf',
'text/plain',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'application/vnd.openxmlformats-officedocument.presentationml.template',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'application/msword',
'application/vnd.ms-excel',
'application/vnd.ms-powerpoint',
'application/csv',
'application/vnd.ms-excel.sheet.macroEnabled.12',
'text/x-tex',
'application/x-pdf',
'application/vnd.ms-excel.sheet.macroenabled.12',
'file/pdf',
'image/pdf',
'text/csv',
'text/pdf',
'text/x-sh',
'\"application/pdf\"',
],
"Audio": ['audio/mpeg', 'audio/mp3', 'audio/x-wav', 'audio/ogg', 'audio/wav', 'audio/aac', 'audio/x-m4a',
'audio/mp4', 'audio/x-ms-wma', ],
"Code": ['application/json', 'text/html', 'text/javascript', 'application/javascript', 'text/css', 'text/x-python',
'application/x-java-jnlp-file', 'application/xml', 'application/postscript', 'application/x-javascript',
'application/java-vm', 'text/x-c++src', 'text/xml', 'text/x-scss', 'application/x-python-code',
'application/java-archive', 'text/x-python-script', 'application/x-ruby', 'application/mathematica',
'text/coffeescript', 'text/x-matlab', 'application/sql', 'text/php', ]