PageRenderTime 62ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/cms/envs/common.py

https://gitlab.com/unofficial-mirrors/edx-platform
Python | 1453 lines | 1056 code | 205 blank | 192 comment | 13 complexity | 90eb4e139daa489f0d41f6a95052902f MD5 | raw file
  1. # -*- coding: utf-8 -*-
  2. """
  3. This is the common settings file, intended to set sane defaults. If you have a
  4. piece of configuration that's dependent on a set of feature flags being set,
  5. then create a function that returns the calculated value based on the value of
  6. FEATURES[...]. Modules that extend this one can change the feature
  7. configuration in an environment specific config file and re-calculate those
  8. values.
  9. We should make a method that calls all these config methods so that you just
  10. make one call at the end of your site-specific dev file to reset all the
  11. dependent variables (like INSTALLED_APPS) for you.
  12. Longer TODO:
  13. 1. Right now our treatment of static content in general and in particular
  14. course-specific static content is haphazard.
  15. 2. We should have a more disciplined approach to feature flagging, even if it
  16. just means that we stick them in a dict called FEATURES.
  17. 3. We need to handle configuration for multiple courses. This could be as
  18. multiple sites, but we do need a way to map their data assets.
  19. When refering to XBlocks, we use the entry-point name. For example,
  20. | setup(
  21. | name='xblock-foobar',
  22. | version='0.1',
  23. | packages=[
  24. | 'foobar_xblock',
  25. | ],
  26. | entry_points={
  27. | 'xblock.v1': [
  28. | 'foobar-block = foobar_xblock:FoobarBlock',
  29. | # ^^^^^^^^^^^^ This is the one you want.
  30. | ]
  31. | },
  32. | )
  33. """
  34. # We intentionally define lots of variables that aren't used, and
  35. # want to import all variables from base settings files
  36. # pylint: disable=unused-import
  37. from __future__ import absolute_import
  38. import imp
  39. import os
  40. import sys
  41. from datetime import timedelta
  42. import lms.envs.common
  43. # Although this module itself may not use these imported variables, other dependent modules may.
  44. from lms.envs.common import (
  45. USE_TZ, TECH_SUPPORT_EMAIL, PLATFORM_NAME, PLATFORM_DESCRIPTION, BUGS_EMAIL, DOC_STORE_CONFIG, DATA_DIR,
  46. ALL_LANGUAGES, WIKI_ENABLED, update_module_store_settings, ASSET_IGNORE_REGEX,
  47. PARENTAL_CONSENT_AGE_LIMIT, REGISTRATION_EMAIL_PATTERNS_ALLOWED,
  48. # The following PROFILE_IMAGE_* settings are included as they are
  49. # indirectly accessed through the email opt-in API, which is
  50. # technically accessible through the CMS via legacy URLs.
  51. PROFILE_IMAGE_BACKEND, PROFILE_IMAGE_DEFAULT_FILENAME, PROFILE_IMAGE_DEFAULT_FILE_EXTENSION,
  52. PROFILE_IMAGE_SECRET_KEY, PROFILE_IMAGE_MIN_BYTES, PROFILE_IMAGE_MAX_BYTES, PROFILE_IMAGE_SIZES_MAP,
  53. # The following setting is included as it is used to check whether to
  54. # display credit eligibility table on the CMS or not.
  55. ENABLE_CREDIT_ELIGIBILITY, YOUTUBE_API_KEY,
  56. COURSE_MODE_DEFAULTS, DEFAULT_COURSE_ABOUT_IMAGE_URL,
  57. # User-uploaded content
  58. MEDIA_ROOT,
  59. MEDIA_URL,
  60. # Lazy Gettext
  61. _,
  62. # Django REST framework configuration
  63. REST_FRAMEWORK,
  64. STATICI18N_OUTPUT_DIR,
  65. # Theme to use when no site or site theme is defined,
  66. DEFAULT_SITE_THEME,
  67. # Default site to use if no site exists matching request headers
  68. SITE_ID,
  69. # Enable or disable theming
  70. ENABLE_COMPREHENSIVE_THEMING,
  71. COMPREHENSIVE_THEME_LOCALE_PATHS,
  72. COMPREHENSIVE_THEME_DIRS,
  73. # constants for redirects app
  74. REDIRECT_CACHE_TIMEOUT,
  75. REDIRECT_CACHE_KEY_PREFIX,
  76. JWT_AUTH,
  77. USERNAME_REGEX_PARTIAL,
  78. USERNAME_PATTERN,
  79. # django-debug-toolbar
  80. DEBUG_TOOLBAR_PATCH_SETTINGS,
  81. BLOCK_STRUCTURES_SETTINGS,
  82. # File upload defaults
  83. FILE_UPLOAD_STORAGE_BUCKET_NAME,
  84. FILE_UPLOAD_STORAGE_PREFIX,
  85. COURSE_ENROLLMENT_MODES,
  86. HELP_TOKENS_BOOKS,
  87. SUPPORT_SITE_LINK,
  88. PASSWORD_RESET_SUPPORT_LINK,
  89. ACTIVATION_EMAIL_SUPPORT_LINK,
  90. CONTACT_EMAIL,
  91. DISABLE_ACCOUNT_ACTIVATION_REQUIREMENT_SWITCH,
  92. # Video Image settings
  93. VIDEO_IMAGE_SETTINGS,
  94. VIDEO_TRANSCRIPTS_SETTINGS,
  95. # Methods to derive settings
  96. _make_main_mako_templates,
  97. _make_locale_paths,
  98. )
  99. from path import Path as path
  100. from warnings import simplefilter
  101. from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin
  102. from cms.lib.xblock.authoring_mixin import AuthoringMixin
  103. import dealer.git
  104. from xmodule.modulestore.edit_info import EditInfoMixin
  105. from openedx.core.djangoapps.theming.helpers_dirs import (
  106. get_themes_unchecked,
  107. get_theme_base_dirs_from_settings
  108. )
  109. from openedx.core.lib.license import LicenseMixin
  110. from openedx.core.lib.derived import derived, derived_dict_entry
  111. from openedx.core.release import doc_version
  112. ############################ FEATURE CONFIGURATION #############################
  113. # Dummy secret key for dev/test
  114. SECRET_KEY = 'dev key'
  115. STUDIO_NAME = _("Your Platform Studio")
  116. STUDIO_SHORT_NAME = _("Studio")
  117. FEATURES = {
  118. 'GITHUB_PUSH': False,
  119. # for consistency in user-experience, keep the value of the following 3 settings
  120. # in sync with the ones in lms/envs/common.py
  121. 'ENABLE_DISCUSSION_SERVICE': True,
  122. 'ENABLE_TEXTBOOK': True,
  123. 'ENABLE_STUDENT_NOTES': True,
  124. 'AUTH_USE_CERTIFICATES': False,
  125. # email address for studio staff (eg to request course creation)
  126. 'STUDIO_REQUEST_EMAIL': '',
  127. # Segment - must explicitly turn it on for production
  128. 'CMS_SEGMENT_KEY': None,
  129. # Enable URL that shows information about the status of various services
  130. 'ENABLE_SERVICE_STATUS': False,
  131. # Don't autoplay videos for course authors
  132. 'AUTOPLAY_VIDEOS': False,
  133. # If set to True, new Studio users won't be able to author courses unless
  134. # an Open edX admin has added them to the course creator group.
  135. 'ENABLE_CREATOR_GROUP': True,
  136. # whether to use password policy enforcement or not
  137. 'ENFORCE_PASSWORD_POLICY': False,
  138. # Turn off account locking if failed login attempts exceeds a limit
  139. 'ENABLE_MAX_FAILED_LOGIN_ATTEMPTS': False,
  140. # Allow editing of short description in course settings in cms
  141. 'EDITABLE_SHORT_DESCRIPTION': True,
  142. # Hide any Personally Identifiable Information from application logs
  143. 'SQUELCH_PII_IN_LOGS': False,
  144. # Toggles the embargo functionality, which blocks users
  145. # based on their location.
  146. 'EMBARGO': False,
  147. # Turn on/off Microsites feature
  148. 'USE_MICROSITES': False,
  149. # Allow creating courses with non-ascii characters in the course id
  150. 'ALLOW_UNICODE_COURSE_ID': False,
  151. # Prevent concurrent logins per user
  152. 'PREVENT_CONCURRENT_LOGINS': False,
  153. # Turn off Advanced Security by default
  154. 'ADVANCED_SECURITY': False,
  155. # Turn off Video Upload Pipeline through Studio, by default
  156. 'ENABLE_VIDEO_UPLOAD_PIPELINE': False,
  157. # let students save and manage their annotations
  158. # for consistency in user-experience, keep the value of this feature flag
  159. # in sync with the one in lms/envs/common.py
  160. 'ENABLE_EDXNOTES': False,
  161. # Enable support for content libraries. Note that content libraries are
  162. # only supported in courses using split mongo.
  163. 'ENABLE_CONTENT_LIBRARIES': True,
  164. # Milestones application flag
  165. 'MILESTONES_APP': False,
  166. # Prerequisite courses feature flag
  167. 'ENABLE_PREREQUISITE_COURSES': False,
  168. # Toggle course entrance exams feature
  169. 'ENTRANCE_EXAMS': False,
  170. # Toggle platform-wide course licensing
  171. 'LICENSING': False,
  172. # Enable the courseware search functionality
  173. 'ENABLE_COURSEWARE_INDEX': False,
  174. # Enable content libraries search functionality
  175. 'ENABLE_LIBRARY_INDEX': False,
  176. # Enable course reruns, which will always use the split modulestore
  177. 'ALLOW_COURSE_RERUNS': True,
  178. # Certificates Web/HTML Views
  179. 'CERTIFICATES_HTML_VIEW': False,
  180. # Teams feature
  181. 'ENABLE_TEAMS': True,
  182. # Show video bumper in Studio
  183. 'ENABLE_VIDEO_BUMPER': False,
  184. # Show issue open badges in Studio
  185. 'ENABLE_OPENBADGES': False,
  186. # How many seconds to show the bumper again, default is 7 days:
  187. 'SHOW_BUMPER_PERIODICITY': 7 * 24 * 3600,
  188. # Enable credit eligibility feature
  189. 'ENABLE_CREDIT_ELIGIBILITY': ENABLE_CREDIT_ELIGIBILITY,
  190. # Can the visibility of the discussion tab be configured on a per-course basis?
  191. 'ALLOW_HIDING_DISCUSSION_TAB': False,
  192. # Special Exams, aka Timed and Proctored Exams
  193. 'ENABLE_SPECIAL_EXAMS': False,
  194. 'ORGANIZATIONS_APP': False,
  195. # Show the language selector in the header
  196. 'SHOW_HEADER_LANGUAGE_SELECTOR': False,
  197. # At edX it's safe to assume that English transcripts are always available
  198. # This is not the case for all installations.
  199. # The default value in {lms,cms}/envs/common.py and xmodule/tests/test_video.py should be consistent.
  200. 'FALLBACK_TO_ENGLISH_TRANSCRIPTS': True,
  201. # Set this to False to facilitate cleaning up invalid xml from your modulestore.
  202. 'ENABLE_XBLOCK_XML_VALIDATION': True,
  203. # Allow public account creation
  204. 'ALLOW_PUBLIC_ACCOUNT_CREATION': True,
  205. # Whether or not the dynamic EnrollmentTrackUserPartition should be registered.
  206. 'ENABLE_ENROLLMENT_TRACK_USER_PARTITION': True,
  207. # Whether archived courses (courses with end dates in the past) should be
  208. # shown in Studio in a separate list.
  209. 'ENABLE_SEPARATE_ARCHIVED_COURSES': True,
  210. }
  211. ENABLE_JASMINE = False
  212. ############################# SOCIAL MEDIA SHARING #############################
  213. SOCIAL_SHARING_SETTINGS = {
  214. # Note: Ensure 'CUSTOM_COURSE_URLS' has a matching value in lms/envs/common.py
  215. 'CUSTOM_COURSE_URLS': False
  216. }
  217. ############################# SET PATH INFORMATION #############################
  218. PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /edx-platform/cms
  219. REPO_ROOT = PROJECT_ROOT.dirname()
  220. COMMON_ROOT = REPO_ROOT / "common"
  221. OPENEDX_ROOT = REPO_ROOT / "openedx"
  222. CMS_ROOT = REPO_ROOT / "cms"
  223. LMS_ROOT = REPO_ROOT / "lms"
  224. ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /edx-platform is in
  225. GITHUB_REPO_ROOT = ENV_ROOT / "data"
  226. sys.path.append(REPO_ROOT)
  227. sys.path.append(PROJECT_ROOT / 'djangoapps')
  228. sys.path.append(COMMON_ROOT / 'djangoapps')
  229. # For geolocation ip database
  230. GEOIP_PATH = REPO_ROOT / "common/static/data/geoip/GeoIP.dat"
  231. GEOIPV6_PATH = REPO_ROOT / "common/static/data/geoip/GeoIPv6.dat"
  232. ############################# TEMPLATE CONFIGURATION #############################
  233. # Mako templating
  234. # TODO: Move the Mako templating into a different engine in TEMPLATES below.
  235. import tempfile
  236. MAKO_MODULE_DIR = os.path.join(tempfile.gettempdir(), 'mako_cms')
  237. MAKO_TEMPLATES = {}
  238. MAIN_MAKO_TEMPLATES_BASE = [
  239. PROJECT_ROOT / 'templates',
  240. COMMON_ROOT / 'templates',
  241. COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates',
  242. COMMON_ROOT / 'static', # required to statically include common Underscore templates
  243. OPENEDX_ROOT / 'core' / 'djangoapps' / 'cors_csrf' / 'templates',
  244. OPENEDX_ROOT / 'core' / 'djangoapps' / 'dark_lang' / 'templates',
  245. OPENEDX_ROOT / 'core' / 'lib' / 'license' / 'templates',
  246. CMS_ROOT / 'djangoapps' / 'pipeline_js' / 'templates',
  247. ]
  248. MAKO_TEMPLATES['lms.main'] = lms.envs.common.MAIN_MAKO_TEMPLATES_BASE
  249. MAKO_TEMPLATES['main'] = _make_main_mako_templates
  250. derived_dict_entry('MAKO_TEMPLATES', 'main')
  251. # Django templating
  252. TEMPLATES = [
  253. {
  254. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  255. # Don't look for template source files inside installed applications.
  256. 'APP_DIRS': False,
  257. # Instead, look for template source files in these dirs.
  258. 'DIRS': MAIN_MAKO_TEMPLATES_BASE,
  259. # Options specific to this backend.
  260. 'OPTIONS': {
  261. 'loaders': (
  262. # We have to use mako-aware template loaders to be able to include
  263. # mako templates inside django templates (such as main_django.html).
  264. 'openedx.core.djangoapps.theming.template_loaders.ThemeTemplateLoader',
  265. 'edxmako.makoloader.MakoFilesystemLoader',
  266. 'edxmako.makoloader.MakoAppDirectoriesLoader',
  267. ),
  268. 'context_processors': (
  269. 'django.template.context_processors.request',
  270. 'django.template.context_processors.static',
  271. 'django.contrib.messages.context_processors.messages',
  272. 'django.template.context_processors.i18n',
  273. 'django.contrib.auth.context_processors.auth', # this is required for admin
  274. 'django.template.context_processors.csrf',
  275. 'dealer.contrib.django.staff.context_processor', # access git revision
  276. 'help_tokens.context_processor',
  277. ),
  278. # Change 'debug' in your environment settings files - not here.
  279. 'debug': False
  280. }
  281. }
  282. ]
  283. DEFAULT_TEMPLATE_ENGINE = TEMPLATES[0]
  284. ##############################################################################
  285. EDX_ROOT_URL = ''
  286. LOGIN_REDIRECT_URL = EDX_ROOT_URL + '/signin'
  287. LOGIN_URL = EDX_ROOT_URL + '/signin'
  288. # use the ratelimit backend to prevent brute force attacks
  289. AUTHENTICATION_BACKENDS = [
  290. 'rules.permissions.ObjectPermissionBackend',
  291. 'ratelimitbackend.backends.RateLimitModelBackend',
  292. ]
  293. LMS_BASE = None
  294. LMS_ROOT_URL = "http://localhost:8000"
  295. LMS_ENROLLMENT_API_PATH = "/api/enrollment/v1/"
  296. ENTERPRISE_API_URL = LMS_ROOT_URL + '/enterprise/api/v1/'
  297. ENTERPRISE_CONSENT_API_URL = LMS_ROOT_URL + '/consent/api/v1/'
  298. # These are standard regexes for pulling out info like course_ids, usage_ids, etc.
  299. # They are used so that URLs with deprecated-format strings still work.
  300. from lms.envs.common import (
  301. COURSE_KEY_PATTERN, COURSE_KEY_REGEX, COURSE_ID_PATTERN, USAGE_KEY_PATTERN, ASSET_KEY_PATTERN
  302. )
  303. ######################### CSRF #########################################
  304. # Forwards-compatibility with Django 1.7
  305. CSRF_COOKIE_AGE = 60 * 60 * 24 * 7 * 52
  306. # It is highly recommended that you override this in any environment accessed by
  307. # end users
  308. CSRF_COOKIE_SECURE = False
  309. #################### CAPA External Code Evaluation #############################
  310. XQUEUE_INTERFACE = {
  311. 'url': 'http://localhost:8888',
  312. 'django_auth': {'username': 'local',
  313. 'password': 'local'},
  314. 'basic_auth': None,
  315. }
  316. ################################# Deprecation warnings #####################
  317. # Ignore deprecation warnings (so we don't clutter Jenkins builds/production)
  318. simplefilter('ignore')
  319. ################################# Middleware ###################################
  320. MIDDLEWARE_CLASSES = [
  321. 'crum.CurrentRequestUserMiddleware',
  322. 'request_cache.middleware.RequestCache',
  323. 'openedx.core.djangoapps.monitoring_utils.middleware.MonitoringMemoryMiddleware',
  324. 'openedx.core.djangoapps.header_control.middleware.HeaderControlMiddleware',
  325. 'django.middleware.cache.UpdateCacheMiddleware',
  326. 'django.middleware.common.CommonMiddleware',
  327. 'django.middleware.csrf.CsrfViewMiddleware',
  328. 'django.contrib.sites.middleware.CurrentSiteMiddleware',
  329. # Instead of SessionMiddleware, we use a more secure version
  330. # 'django.contrib.sessions.middleware.SessionMiddleware',
  331. 'openedx.core.djangoapps.safe_sessions.middleware.SafeSessionMiddleware',
  332. 'method_override.middleware.MethodOverrideMiddleware',
  333. # Instead of AuthenticationMiddleware, we use a cache-backed version
  334. 'openedx.core.djangoapps.cache_toolbox.middleware.CacheBackedAuthenticationMiddleware',
  335. # Enable SessionAuthenticationMiddleware in order to invalidate
  336. # user sessions after a password change.
  337. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  338. 'student.middleware.UserStandingMiddleware',
  339. 'openedx.core.djangoapps.contentserver.middleware.StaticContentServer',
  340. 'django.contrib.messages.middleware.MessageMiddleware',
  341. 'track.middleware.TrackMiddleware',
  342. # This is used to set or update the user language preferences.
  343. 'openedx.core.djangoapps.lang_pref.middleware.LanguagePreferenceMiddleware',
  344. # Allows us to dark-launch particular languages
  345. 'openedx.core.djangoapps.dark_lang.middleware.DarkLangMiddleware',
  346. 'openedx.core.djangoapps.embargo.middleware.EmbargoMiddleware',
  347. # Detects user-requested locale from 'accept-language' header in http request
  348. 'django.middleware.locale.LocaleMiddleware',
  349. 'codejail.django_integration.ConfigureCodeJailMiddleware',
  350. # catches any uncaught RateLimitExceptions and returns a 403 instead of a 500
  351. 'ratelimitbackend.middleware.RateLimitMiddleware',
  352. # for expiring inactive sessions
  353. 'openedx.core.djangoapps.session_inactivity_timeout.middleware.SessionInactivityTimeout',
  354. 'openedx.core.djangoapps.theming.middleware.CurrentSiteThemeMiddleware',
  355. # use Django built in clickjacking protection
  356. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  357. 'waffle.middleware.WaffleMiddleware',
  358. # This must be last so that it runs first in the process_response chain
  359. 'openedx.core.djangoapps.site_configuration.middleware.SessionCookieDomainOverrideMiddleware',
  360. ]
  361. # Clickjacking protection can be enabled by setting this to 'DENY'
  362. X_FRAME_OPTIONS = 'ALLOW'
  363. # Platform for Privacy Preferences header
  364. P3P_HEADER = 'CP="Open EdX does not have a P3P policy."'
  365. ############# XBlock Configuration ##########
  366. # Import after sys.path fixup
  367. from xmodule.modulestore.inheritance import InheritanceMixin
  368. from xmodule.modulestore import prefer_xmodules
  369. from xmodule.x_module import XModuleMixin
  370. # These are the Mixins that should be added to every XBlock.
  371. # This should be moved into an XBlock Runtime/Application object
  372. # once the responsibility of XBlock creation is moved out of modulestore - cpennington
  373. XBLOCK_MIXINS = (
  374. LmsBlockMixin,
  375. InheritanceMixin,
  376. XModuleMixin,
  377. EditInfoMixin,
  378. AuthoringMixin,
  379. )
  380. XBLOCK_SELECT_FUNCTION = prefer_xmodules
  381. # Paths to wrapper methods which should be applied to every XBlock's FieldData.
  382. XBLOCK_FIELD_DATA_WRAPPERS = ()
  383. ############################ Modulestore Configuration ################################
  384. MODULESTORE_BRANCH = 'draft-preferred'
  385. MODULESTORE = {
  386. 'default': {
  387. 'ENGINE': 'xmodule.modulestore.mixed.MixedModuleStore',
  388. 'OPTIONS': {
  389. 'mappings': {},
  390. 'stores': [
  391. {
  392. 'NAME': 'split',
  393. 'ENGINE': 'xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore',
  394. 'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
  395. 'OPTIONS': {
  396. 'default_class': 'xmodule.hidden_module.HiddenDescriptor',
  397. 'fs_root': DATA_DIR,
  398. 'render_template': 'edxmako.shortcuts.render_to_string',
  399. }
  400. },
  401. {
  402. 'NAME': 'draft',
  403. 'ENGINE': 'xmodule.modulestore.mongo.DraftMongoModuleStore',
  404. 'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
  405. 'OPTIONS': {
  406. 'default_class': 'xmodule.hidden_module.HiddenDescriptor',
  407. 'fs_root': DATA_DIR,
  408. 'render_template': 'edxmako.shortcuts.render_to_string',
  409. }
  410. }
  411. ]
  412. }
  413. }
  414. }
  415. # Modulestore-level field override providers. These field override providers don't
  416. # require student context.
  417. MODULESTORE_FIELD_OVERRIDE_PROVIDERS = ()
  418. #################### Python sandbox ############################################
  419. CODE_JAIL = {
  420. # Path to a sandboxed Python executable. None means don't bother.
  421. 'python_bin': None,
  422. # User to run as in the sandbox.
  423. 'user': 'sandbox',
  424. # Configurable limits.
  425. 'limits': {
  426. # How many CPU seconds can jailed code use?
  427. 'CPU': 1,
  428. },
  429. }
  430. ############################ DJANGO_BUILTINS ################################
  431. # Change DEBUG in your environment settings files, not here
  432. DEBUG = False
  433. SESSION_COOKIE_SECURE = False
  434. SESSION_SAVE_EVERY_REQUEST = False
  435. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
  436. # Site info
  437. SITE_NAME = "localhost:8001"
  438. HTTPS = 'on'
  439. ROOT_URLCONF = 'cms.urls'
  440. # Email
  441. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  442. EMAIL_HOST = 'localhost'
  443. EMAIL_PORT = 25
  444. EMAIL_USE_TLS = False
  445. EMAIL_HOST_USER = ''
  446. EMAIL_HOST_PASSWORD = ''
  447. DEFAULT_FROM_EMAIL = 'registration@example.com'
  448. DEFAULT_FEEDBACK_EMAIL = 'feedback@example.com'
  449. SERVER_EMAIL = 'devops@example.com'
  450. ADMINS = []
  451. MANAGERS = ADMINS
  452. EDX_PLATFORM_REVISION = os.environ.get('EDX_PLATFORM_REVISION')
  453. if not EDX_PLATFORM_REVISION:
  454. try:
  455. # Get git revision of the current file
  456. EDX_PLATFORM_REVISION = dealer.git.Backend(path=REPO_ROOT).revision
  457. except TypeError:
  458. # Not a git repository
  459. EDX_PLATFORM_REVISION = 'unknown'
  460. # Static content
  461. STATIC_URL = '/static/' + EDX_PLATFORM_REVISION + "/"
  462. STATIC_ROOT = ENV_ROOT / "staticfiles" / EDX_PLATFORM_REVISION
  463. STATICFILES_DIRS = [
  464. COMMON_ROOT / "static",
  465. PROJECT_ROOT / "static",
  466. # This is how you would use the textbook images locally
  467. # ("book", ENV_ROOT / "book_images"),
  468. ]
  469. # Locale/Internationalization
  470. TIME_ZONE = 'America/New_York' # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  471. LANGUAGE_CODE = 'en' # http://www.i18nguy.com/unicode/language-identifiers.html
  472. LANGUAGES_BIDI = lms.envs.common.LANGUAGES_BIDI
  473. LANGUAGE_COOKIE = lms.envs.common.LANGUAGE_COOKIE
  474. LANGUAGES = lms.envs.common.LANGUAGES
  475. LANGUAGE_DICT = dict(LANGUAGES)
  476. USE_I18N = True
  477. USE_L10N = True
  478. STATICI18N_ROOT = PROJECT_ROOT / "static"
  479. # Localization strings (e.g. django.po) are under these directories
  480. LOCALE_PATHS = _make_locale_paths
  481. derived('LOCALE_PATHS')
  482. # Messages
  483. MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
  484. COURSE_IMPORT_EXPORT_STORAGE = 'django.core.files.storage.FileSystemStorage'
  485. ##### EMBARGO #####
  486. EMBARGO_SITE_REDIRECT_URL = None
  487. ############################### PIPELINE #######################################
  488. PIPELINE_ENABLED = True
  489. STATICFILES_STORAGE = 'openedx.core.storage.ProductionStorage'
  490. # List of finder classes that know how to find static files in various locations.
  491. # Note: the pipeline finder is included to be able to discover optimized files
  492. STATICFILES_FINDERS = [
  493. 'openedx.core.djangoapps.theming.finders.ThemeFilesFinder',
  494. 'django.contrib.staticfiles.finders.FileSystemFinder',
  495. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  496. 'openedx.core.lib.xblock_pipeline.finder.XBlockPipelineFinder',
  497. 'pipeline.finders.PipelineFinder',
  498. ]
  499. # Don't use compression by default
  500. PIPELINE_CSS_COMPRESSOR = None
  501. PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.uglifyjs.UglifyJSCompressor'
  502. # Don't wrap JavaScript as there is code that depends upon updating the global namespace
  503. PIPELINE_DISABLE_WRAPPER = True
  504. # Specify the UglifyJS binary to use
  505. PIPELINE_UGLIFYJS_BINARY = 'node_modules/.bin/uglifyjs'
  506. from openedx.core.lib.rooted_paths import rooted_glob
  507. PIPELINE_CSS = {
  508. 'style-vendor': {
  509. 'source_filenames': [
  510. 'css/vendor/normalize.css',
  511. 'css/vendor/font-awesome.css',
  512. 'css/vendor/html5-input-polyfills/number-polyfill.css',
  513. 'js/vendor/CodeMirror/codemirror.css',
  514. 'css/vendor/ui-lightness/jquery-ui-1.8.22.custom.css',
  515. 'css/vendor/jquery.qtip.min.css',
  516. 'js/vendor/markitup/skins/simple/style.css',
  517. 'js/vendor/markitup/sets/wiki/style.css',
  518. ],
  519. 'output_filename': 'css/cms-style-vendor.css',
  520. },
  521. 'style-vendor-tinymce-content': {
  522. 'source_filenames': [
  523. 'css/tinymce-studio-content-fonts.css',
  524. 'js/vendor/tinymce/js/tinymce/skins/studio-tmce4/content.min.css',
  525. 'css/tinymce-studio-content.css'
  526. ],
  527. 'output_filename': 'css/cms-style-vendor-tinymce-content.css',
  528. },
  529. 'style-vendor-tinymce-skin': {
  530. 'source_filenames': [
  531. 'js/vendor/tinymce/js/tinymce/skins/studio-tmce4/skin.min.css'
  532. ],
  533. 'output_filename': 'css/cms-style-vendor-tinymce-skin.css',
  534. },
  535. 'style-main-v1': {
  536. 'source_filenames': [
  537. 'css/studio-main-v1.css',
  538. ],
  539. 'output_filename': 'css/studio-main-v1.css',
  540. },
  541. 'style-main-v1-rtl': {
  542. 'source_filenames': [
  543. 'css/studio-main-v1-rtl.css',
  544. ],
  545. 'output_filename': 'css/studio-main-v1-rtl.css',
  546. },
  547. 'style-main-v2': {
  548. 'source_filenames': [
  549. 'css/studio-main-v2.css',
  550. ],
  551. 'output_filename': 'css/studio-main-v2.css',
  552. },
  553. 'style-main-v2-rtl': {
  554. 'source_filenames': [
  555. 'css/studio-main-v2-rtl.css',
  556. ],
  557. 'output_filename': 'css/studio-main-v2-rtl.css',
  558. },
  559. 'style-xmodule-annotations': {
  560. 'source_filenames': [
  561. 'css/vendor/ova/annotator.css',
  562. 'css/vendor/ova/edx-annotator.css',
  563. 'css/vendor/ova/video-js.min.css',
  564. 'css/vendor/ova/rangeslider.css',
  565. 'css/vendor/ova/share-annotator.css',
  566. 'css/vendor/ova/richText-annotator.css',
  567. 'css/vendor/ova/tags-annotator.css',
  568. 'css/vendor/ova/flagging-annotator.css',
  569. 'css/vendor/ova/diacritic-annotator.css',
  570. 'css/vendor/ova/grouping-annotator.css',
  571. 'css/vendor/ova/ova.css',
  572. 'js/vendor/ova/catch/css/main.css'
  573. ],
  574. 'output_filename': 'css/cms-style-xmodule-annotations.css',
  575. },
  576. }
  577. base_vendor_js = [
  578. 'js/src/utility.js',
  579. 'js/src/logger.js',
  580. 'common/js/vendor/jquery.js',
  581. 'common/js/vendor/jquery-migrate.js',
  582. 'js/vendor/jquery.cookie.js',
  583. 'js/vendor/url.min.js',
  584. 'common/js/vendor/underscore.js',
  585. 'common/js/vendor/underscore.string.js',
  586. 'common/js/vendor/backbone.js',
  587. 'js/vendor/URI.min.js',
  588. # Make some edX UI Toolkit utilities available in the global "edx" namespace
  589. 'edx-ui-toolkit/js/utils/global-loader.js',
  590. 'edx-ui-toolkit/js/utils/string-utils.js',
  591. 'edx-ui-toolkit/js/utils/html-utils.js',
  592. # Load Bootstrap and supporting libraries
  593. 'common/js/vendor/popper.js',
  594. 'common/js/vendor/bootstrap.js',
  595. # Finally load RequireJS
  596. 'common/js/vendor/require.js'
  597. ]
  598. # test_order: Determines the position of this chunk of javascript on
  599. # the jasmine test page
  600. PIPELINE_JS = {
  601. 'base_vendor': {
  602. 'source_filenames': base_vendor_js,
  603. 'output_filename': 'js/cms-base-vendor.js',
  604. },
  605. 'module-js': {
  606. 'source_filenames': (
  607. rooted_glob(COMMON_ROOT / 'static/', 'xmodule/descriptors/js/*.js') +
  608. rooted_glob(COMMON_ROOT / 'static/', 'xmodule/modules/js/*.js') +
  609. rooted_glob(COMMON_ROOT / 'static/', 'common/js/discussion/*.js')
  610. ),
  611. 'output_filename': 'js/cms-modules.js',
  612. 'test_order': 1
  613. },
  614. }
  615. PIPELINE_COMPILERS = (
  616. 'pipeline.compilers.coffee.CoffeeScriptCompiler',
  617. )
  618. PIPELINE_CSS_COMPRESSOR = None
  619. PIPELINE_JS_COMPRESSOR = None
  620. STATICFILES_IGNORE_PATTERNS = (
  621. "*.py",
  622. "*.pyc",
  623. # It would be nice if we could do, for example, "**/*.scss",
  624. # but these strings get passed down to the `fnmatch` module,
  625. # which doesn't support that. :(
  626. # http://docs.python.org/2/library/fnmatch.html
  627. "sass/*.scss",
  628. "sass/*/*.scss",
  629. "sass/*/*/*.scss",
  630. "sass/*/*/*/*.scss",
  631. "coffee/*.coffee",
  632. "coffee/*/*.coffee",
  633. "coffee/*/*/*.coffee",
  634. "coffee/*/*/*/*.coffee",
  635. # Ignore tests
  636. "spec",
  637. "spec_helpers",
  638. # Symlinks used by js-test-tool
  639. "xmodule_js",
  640. "common_static",
  641. )
  642. PIPELINE_YUI_BINARY = 'yui-compressor'
  643. ################################# DJANGO-REQUIRE ###############################
  644. # The baseUrl to pass to the r.js optimizer, relative to STATIC_ROOT.
  645. REQUIRE_BASE_URL = "./"
  646. # The name of a build profile to use for your project, relative to REQUIRE_BASE_URL.
  647. # A sensible value would be 'app.build.js'. Leave blank to use the built-in default build profile.
  648. # Set to False to disable running the default profile (e.g. if only using it to build Standalone
  649. # Modules)
  650. REQUIRE_BUILD_PROFILE = "cms/js/build.js"
  651. # The name of the require.js script used by your project, relative to REQUIRE_BASE_URL.
  652. REQUIRE_JS = "js/vendor/requiresjs/require.js"
  653. # Whether to run django-require in debug mode.
  654. REQUIRE_DEBUG = False
  655. ########################## DJANGO WEBPACK LOADER ##############################
  656. WEBPACK_LOADER = {
  657. 'DEFAULT': {
  658. 'BUNDLE_DIR_NAME': 'bundles/',
  659. 'STATS_FILE': os.path.join(STATIC_ROOT, 'webpack-stats.json')
  660. }
  661. }
  662. WEBPACK_CONFIG_PATH = 'webpack.prod.config.js'
  663. ################################# CELERY ######################################
  664. # Message configuration
  665. CELERY_TASK_SERIALIZER = 'json'
  666. CELERY_RESULT_SERIALIZER = 'json'
  667. CELERY_MESSAGE_COMPRESSION = 'gzip'
  668. # Results configuration
  669. CELERY_IGNORE_RESULT = False
  670. CELERY_STORE_ERRORS_EVEN_IF_IGNORED = True
  671. # Events configuration
  672. CELERY_TRACK_STARTED = True
  673. CELERY_SEND_EVENTS = True
  674. CELERY_SEND_TASK_SENT_EVENT = True
  675. # Exchange configuration
  676. CELERY_DEFAULT_EXCHANGE = 'edx.core'
  677. CELERY_DEFAULT_EXCHANGE_TYPE = 'direct'
  678. # Queues configuration
  679. HIGH_PRIORITY_QUEUE = 'edx.core.high'
  680. DEFAULT_PRIORITY_QUEUE = 'edx.core.default'
  681. LOW_PRIORITY_QUEUE = 'edx.core.low'
  682. CELERY_QUEUE_HA_POLICY = 'all'
  683. CELERY_CREATE_MISSING_QUEUES = True
  684. CELERY_DEFAULT_QUEUE = DEFAULT_PRIORITY_QUEUE
  685. CELERY_DEFAULT_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE
  686. CELERY_QUEUES = {
  687. HIGH_PRIORITY_QUEUE: {},
  688. LOW_PRIORITY_QUEUE: {},
  689. DEFAULT_PRIORITY_QUEUE: {}
  690. }
  691. ############################## Video ##########################################
  692. YOUTUBE = {
  693. # YouTube JavaScript API
  694. 'API': 'https://www.youtube.com/iframe_api',
  695. 'TEST_TIMEOUT': 1500,
  696. # URL to get YouTube metadata
  697. 'METADATA_URL': 'https://www.googleapis.com/youtube/v3/videos',
  698. # Current youtube api for requesting transcripts.
  699. # For example: http://video.google.com/timedtext?lang=en&v=j_jEn79vS3g.
  700. 'TEXT_API': {
  701. 'url': 'video.google.com/timedtext',
  702. 'params': {
  703. 'lang': 'en',
  704. 'v': 'set_youtube_id_of_11_symbols_here',
  705. },
  706. },
  707. 'IMAGE_API': 'http://img.youtube.com/vi/{youtube_id}/0.jpg', # /maxresdefault.jpg for 1920*1080
  708. }
  709. ############################# VIDEO UPLOAD PIPELINE #############################
  710. VIDEO_UPLOAD_PIPELINE = {
  711. 'BUCKET': '',
  712. 'ROOT_PATH': '',
  713. 'CONCURRENT_UPLOAD_LIMIT': 4,
  714. }
  715. ############################ APPS #####################################
  716. # The order of INSTALLED_APPS is important, when adding new apps here
  717. # remember to check that you are not creating new
  718. # RemovedInDjango19Warnings in the test logs.
  719. INSTALLED_APPS = [
  720. # Standard apps
  721. 'django.contrib.auth',
  722. 'django.contrib.contenttypes',
  723. 'django.contrib.redirects',
  724. 'django.contrib.sessions',
  725. 'django.contrib.sites',
  726. 'django.contrib.messages',
  727. 'django.contrib.staticfiles',
  728. 'djcelery',
  729. 'method_override',
  730. # Common Initialization
  731. 'openedx.core.djangoapps.common_initialization.apps.CommonInitializationConfig',
  732. # Common views
  733. 'openedx.core.djangoapps.common_views',
  734. # History tables
  735. 'simple_history',
  736. # Database-backed configuration
  737. 'config_models',
  738. 'waffle',
  739. # Monitor the status of services
  740. 'openedx.core.djangoapps.service_status',
  741. # Bookmarks
  742. 'openedx.core.djangoapps.bookmarks.apps.BookmarksConfig',
  743. # Video module configs (This will be moved to Video once it becomes an XBlock)
  744. 'openedx.core.djangoapps.video_config',
  745. # edX Video Pipeline integration
  746. 'openedx.core.djangoapps.video_pipeline',
  747. # For CMS
  748. 'contentstore.apps.ContentstoreConfig',
  749. 'openedx.core.djangoapps.contentserver',
  750. 'course_creators',
  751. 'openedx.core.djangoapps.external_auth',
  752. 'student', # misleading name due to sharing with lms
  753. 'openedx.core.djangoapps.course_groups', # not used in cms (yet), but tests run
  754. 'xblock_config.apps.XBlockConfig',
  755. # Maintenance tools
  756. 'maintenance',
  757. 'openedx.core.djangoapps.util.apps.UtilConfig',
  758. # Tracking
  759. 'track',
  760. 'eventtracking.django.apps.EventTrackingConfig',
  761. # Monitoring
  762. 'openedx.core.djangoapps.datadog.apps.DatadogConfig',
  763. # For asset pipelining
  764. 'edxmako.apps.EdxMakoConfig',
  765. 'pipeline',
  766. 'static_replace',
  767. 'require',
  768. 'webpack_loader',
  769. # Theming
  770. 'openedx.core.djangoapps.theming.apps.ThemingConfig',
  771. # Site configuration for theming and behavioral modification
  772. 'openedx.core.djangoapps.site_configuration',
  773. # Ability to detect and special-case crawler behavior
  774. 'openedx.core.djangoapps.crawlers',
  775. # comment common
  776. 'django_comment_common',
  777. # for course creator table
  778. 'django.contrib.admin',
  779. # for managing course modes
  780. 'course_modes.apps.CourseModesConfig',
  781. # Verified Track Content Cohorting (Beta feature that will hopefully be removed)
  782. 'openedx.core.djangoapps.verified_track_content',
  783. # Dark-launching languages
  784. 'openedx.core.djangoapps.dark_lang',
  785. # User preferences
  786. 'openedx.core.djangoapps.user_api',
  787. 'django_openid_auth',
  788. # Country embargo support
  789. 'openedx.core.djangoapps.embargo',
  790. # Signals
  791. 'openedx.core.djangoapps.signals.apps.SignalConfig',
  792. # Course action state
  793. 'course_action_state',
  794. # Additional problem types
  795. 'edx_jsme', # Molecular Structure
  796. 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig',
  797. 'openedx.core.djangoapps.content.course_structures.apps.CourseStructuresConfig',
  798. 'openedx.core.djangoapps.content.block_structure.apps.BlockStructureConfig',
  799. # edx-milestones service
  800. 'milestones',
  801. # Self-paced course configuration
  802. 'openedx.core.djangoapps.self_paced',
  803. # Coursegraph
  804. 'openedx.core.djangoapps.coursegraph.apps.CoursegraphConfig',
  805. # Credit courses
  806. 'openedx.core.djangoapps.credit.apps.CreditConfig',
  807. 'xblock_django',
  808. # edX Proctoring
  809. 'edx_proctoring',
  810. # Catalog integration
  811. 'openedx.core.djangoapps.catalog',
  812. # django-oauth2-provider (deprecated)
  813. 'provider',
  814. 'provider.oauth2',
  815. 'edx_oauth2_provider',
  816. # django-oauth-toolkit
  817. 'oauth2_provider',
  818. # These are apps that aren't strictly needed by Studio, but are imported by
  819. # other apps that are. Django 1.8 wants to have imported models supported
  820. # by installed apps.
  821. 'oauth_provider',
  822. 'courseware',
  823. 'survey',
  824. 'lms.djangoapps.verify_student.apps.VerifyStudentConfig',
  825. 'lms.djangoapps.completion.apps.CompletionAppConfig',
  826. # Microsite configuration application
  827. 'microsite_configuration',
  828. # Static i18n support
  829. 'statici18n',
  830. # Tagging
  831. 'cms.lib.xblock.tagging',
  832. # Enables default site and redirects
  833. 'django_sites_extensions',
  834. # additional release utilities to ease automation
  835. 'release_util',
  836. # rule-based authorization
  837. 'rules.apps.AutodiscoverRulesConfig',
  838. # management of user-triggered async tasks (course import/export, etc.)
  839. 'user_tasks',
  840. # CMS specific user task handling
  841. 'cms_user_tasks.apps.CmsUserTasksConfig',
  842. # Unusual migrations
  843. 'database_fixups',
  844. # Customized celery tasks, including persisting failed tasks so they can
  845. # be retried
  846. 'celery_utils',
  847. # Waffle related utilities
  848. 'openedx.core.djangoapps.waffle_utils',
  849. # Dynamic schedules
  850. 'openedx.core.djangoapps.schedules.apps.SchedulesConfig',
  851. # DRF filters
  852. 'django_filters',
  853. 'cms.djangoapps.api',
  854. ]
  855. ################# EDX MARKETING SITE ##################################
  856. EDXMKTG_LOGGED_IN_COOKIE_NAME = 'edxloggedin'
  857. EDXMKTG_USER_INFO_COOKIE_NAME = 'edx-user-info'
  858. EDXMKTG_USER_INFO_COOKIE_VERSION = 1
  859. MKTG_URLS = {}
  860. MKTG_URL_LINK_MAP = {
  861. }
  862. COURSES_WITH_UNSAFE_CODE = []
  863. ############################## EVENT TRACKING #################################
  864. TRACK_MAX_EVENT = 50000
  865. TRACKING_BACKENDS = {
  866. 'logger': {
  867. 'ENGINE': 'track.backends.logger.LoggerBackend',
  868. 'OPTIONS': {
  869. 'name': 'tracking'
  870. }
  871. }
  872. }
  873. # We're already logging events, and we don't want to capture user
  874. # names/passwords. Heartbeat events are likely not interesting.
  875. TRACKING_IGNORE_URL_PATTERNS = [r'^/event', r'^/login', r'^/heartbeat']
  876. EVENT_TRACKING_ENABLED = True
  877. EVENT_TRACKING_BACKENDS = {
  878. 'tracking_logs': {
  879. 'ENGINE': 'eventtracking.backends.routing.RoutingBackend',
  880. 'OPTIONS': {
  881. 'backends': {
  882. 'logger': {
  883. 'ENGINE': 'eventtracking.backends.logger.LoggerBackend',
  884. 'OPTIONS': {
  885. 'name': 'tracking',
  886. 'max_event_size': TRACK_MAX_EVENT,
  887. }
  888. }
  889. },
  890. 'processors': [
  891. {'ENGINE': 'track.shim.LegacyFieldMappingProcessor'},
  892. {'ENGINE': 'track.shim.PrefixedEventProcessor'}
  893. ]
  894. }
  895. },
  896. 'segmentio': {
  897. 'ENGINE': 'eventtracking.backends.routing.RoutingBackend',
  898. 'OPTIONS': {
  899. 'backends': {
  900. 'segment': {'ENGINE': 'eventtracking.backends.segment.SegmentBackend'}
  901. },
  902. 'processors': [
  903. {
  904. 'ENGINE': 'eventtracking.processors.whitelist.NameWhitelistProcessor',
  905. 'OPTIONS': {
  906. 'whitelist': []
  907. }
  908. },
  909. {
  910. 'ENGINE': 'track.shim.GoogleAnalyticsProcessor'
  911. }
  912. ]
  913. }
  914. }
  915. }
  916. EVENT_TRACKING_PROCESSORS = []
  917. #### PASSWORD POLICY SETTINGS #####
  918. PASSWORD_MIN_LENGTH = None
  919. PASSWORD_MAX_LENGTH = None
  920. PASSWORD_COMPLEXITY = {}
  921. PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD = None
  922. PASSWORD_DICTIONARY = []
  923. ##### ACCOUNT LOCKOUT DEFAULT PARAMETERS #####
  924. MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED = 5
  925. MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = 15 * 60
  926. ### Apps only installed in some instances
  927. # The order of INSTALLED_APPS matters, so this tuple is the app name and the item in INSTALLED_APPS
  928. # that this app should be inserted *before*. A None here means it should be appended to the list.
  929. OPTIONAL_APPS = (
  930. ('mentoring', None),
  931. ('problem_builder', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'),
  932. ('edx_sga', None),
  933. # edx-ora2
  934. ('submissions', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'),
  935. ('openassessment', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'),
  936. ('openassessment.assessment', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'),
  937. ('openassessment.fileupload', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'),
  938. ('openassessment.workflow', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'),
  939. ('openassessment.xblock', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'),
  940. # edxval
  941. ('edxval', 'openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig'),
  942. # Organizations App (http://github.com/edx/edx-organizations)
  943. ('organizations', None),
  944. # Enterprise App (http://github.com/edx/edx-enterprise)
  945. ('enterprise', None),
  946. ('consent', None),
  947. )
  948. for app_name, insert_before in OPTIONAL_APPS:
  949. # First attempt to only find the module rather than actually importing it,
  950. # to avoid circular references - only try to import if it can't be found
  951. # by find_module, which doesn't work with import hooks
  952. try:
  953. imp.find_module(app_name)
  954. except ImportError:
  955. try:
  956. __import__(app_name)
  957. except ImportError:
  958. continue
  959. try:
  960. INSTALLED_APPS.insert(INSTALLED_APPS.index(insert_before), app_name)
  961. except (IndexError, ValueError):
  962. INSTALLED_APPS.append(app_name)
  963. ### ADVANCED_SECURITY_CONFIG
  964. # Empty by default
  965. ADVANCED_SECURITY_CONFIG = {}
  966. ### External auth usage -- prefixes for ENROLLMENT_DOMAIN
  967. SHIBBOLETH_DOMAIN_PREFIX = 'shib:'
  968. OPENID_DOMAIN_PREFIX = 'openid:'
  969. ### Size of chunks into which asset uploads will be divided
  970. UPLOAD_CHUNK_SIZE_IN_MB = 10
  971. ### Max size of asset uploads to GridFS
  972. MAX_ASSET_UPLOAD_FILE_SIZE_IN_MB = 10
  973. # FAQ url to direct users to if they upload
  974. # a file that exceeds the above size
  975. MAX_ASSET_UPLOAD_FILE_SIZE_URL = ""
  976. ### Default value for entrance exam minimum score
  977. ENTRANCE_EXAM_MIN_SCORE_PCT = 50
  978. ### Default language for a new course
  979. DEFAULT_COURSE_LANGUAGE = "en"
  980. # Specify XBlocks that should be treated as advanced problems. Each entry is a
  981. # dict:
  982. # 'component': the entry-point name of the XBlock.
  983. # 'boilerplate_name': an optional YAML template to be used. Specify as
  984. # None to omit.
  985. #
  986. ADVANCED_PROBLEM_TYPES = [
  987. {
  988. 'component': 'openassessment',
  989. 'boilerplate_name': None,
  990. },
  991. {
  992. 'component': 'drag-and-drop-v2',
  993. 'boilerplate_name': None
  994. }
  995. ]
  996. # Files and Uploads type filter values
  997. FILES_AND_UPLOAD_TYPE_FILTERS = {
  998. "Images": ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/tiff', 'image/tif', 'image/x-icon',
  999. 'image/svg+xml', 'image/bmp', 'image/x-ms-bmp', ],
  1000. "Documents": [
  1001. 'application/pdf',
  1002. 'text/plain',
  1003. 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  1004. 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
  1005. 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
  1006. 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
  1007. 'application/vnd.openxmlformats-officedocument.presentationml.template',
  1008. 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  1009. 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
  1010. 'application/msword',
  1011. 'application/vnd.ms-excel',
  1012. 'application/vnd.ms-powerpoint',
  1013. 'application/csv',
  1014. 'application/vnd.ms-excel.sheet.macroEnabled.12',
  1015. 'text/x-tex',
  1016. 'application/x-pdf',
  1017. 'application/vnd.ms-excel.sheet.macroenabled.12',
  1018. 'file/pdf',
  1019. 'image/pdf',
  1020. 'text/csv',
  1021. 'text/pdf',
  1022. 'text/x-sh',
  1023. '\application/pdf\""',
  1024. ],
  1025. "Audio": ['audio/mpeg', 'audio/mp3', 'audio/x-wav', 'audio/ogg', 'audio/wav', 'audio/aac', 'audio/x-m4a',
  1026. 'audio/mp4', 'audio/x-ms-wma', ],
  1027. "Code": ['application/json', 'text/html', 'text/javascript', 'application/javascript', 'text/css', 'text/x-python',
  1028. 'application/x-java-jnlp-file', 'application/xml', 'application/postscript', 'application/x-javascript',
  1029. 'application/java-vm', 'text/x-c++src', 'text/xml', 'text/x-scss', 'application/x-python-code',
  1030. 'application/java-archive', 'text/x-python-script', 'application/x-ruby', 'application/mathematica',
  1031. 'text/coffeescript', 'text/x-matlab', 'application/sql', 'text/php', ]
  1032. }
  1033. # Default to no Search Engine
  1034. SEARCH_ENGINE = None
  1035. ELASTIC_FIELD_MAPPINGS = {
  1036. "start_date": {
  1037. "type": "date"
  1038. }
  1039. }
  1040. XBLOCK_SETTINGS = {
  1041. "VideoDescriptor": {
  1042. "licensing_enabled": FEATURES.get("LICENSING", False)
  1043. },
  1044. 'VideoModule': {
  1045. 'YOUTUBE_API_KEY': YOUTUBE_API_KEY
  1046. }
  1047. }
  1048. ################################ Settings for Credit Course Requirements ################################
  1049. # Initial delay used for retrying tasks.
  1050. # Additional retries use longer delays.
  1051. # Value is in seconds.
  1052. CREDIT_TASK_DEFAULT_RETRY_DELAY = 30
  1053. # Maximum number of retries per task for errors that are not related
  1054. # to throttling.
  1055. CREDIT_TASK_MAX_RETRIES = 5
  1056. # Maximum age in seconds of timestamps we will accept
  1057. # when a credit provider notifies us that a student has been approved
  1058. # or denied for credit.
  1059. CREDIT_PROVIDER_TIMESTAMP_EXPIRATION = 15 * 60
  1060. ################################ Settings for Microsites ################################
  1061. ### Select an implementation for the microsite backend
  1062. # for MICROSITE_BACKEND possible choices are
  1063. # 1. microsite_configuration.backends.filebased.FilebasedMicrositeBackend
  1064. # 2. microsite_configuration.backends.database.DatabaseMicrositeBackend
  1065. MICROSITE_BACKEND = 'microsite_configuration.backends.filebased.FilebasedMicrositeBackend'
  1066. # for MICROSITE_TEMPLATE_BACKEND possible choices are
  1067. # 1. microsite_configuration.backends.filebased.FilebasedMicrositeTemplateBackend
  1068. # 2. microsite_configuration.backends.database.DatabaseMicrositeTemplateBackend
  1069. MICROSITE_TEMPLATE_BACKEND = 'microsite_configuration.backends.filebased.FilebasedMicrositeTemplateBackend'
  1070. # TTL for microsite database template cache
  1071. MICROSITE_DATABASE_TEMPLATE_CACHE_TTL = 5 * 60
  1072. ############################### PROCTORING CONFIGURATION DEFAULTS ##############
  1073. PROCTORING_BACKEND_PROVIDER = {
  1074. 'class': 'edx_proctoring.backends.null.NullBackendProvider',
  1075. 'options': {},
  1076. }
  1077. PROCTORING_SETTINGS = {}
  1078. ############################ Global Database Configuration #####################
  1079. DATABASE_ROUTERS = [
  1080. 'openedx.core.lib.django_courseware_routers.StudentModuleHistoryExtendedRouter',
  1081. ]
  1082. ############################ OAUTH2 Provider ###################################
  1083. # OpenID Connect issuer ID. Normally the URL of the authentication endpoint.
  1084. OAUTH_OIDC_ISSUER = 'https://www.example.com/oauth2'
  1085. # 5 minute expiration time for JWT id tokens issued for external API requests.
  1086. OAUTH_ID_TOKEN_EXPIRATION = 5 * 60
  1087. # Partner support link for CMS footer
  1088. PARTNER_SUPPORT_EMAIL = ''
  1089. # Affiliate cookie tracking
  1090. AFFILIATE_COOKIE_NAME = 'affiliate_id'
  1091. ############## Settings for Studio Context Sensitive Help ##############
  1092. HELP_TOKENS_INI_FILE = REPO_ROOT / "cms" / "envs" / "help_tokens.ini"
  1093. HELP_TOKENS_LANGUAGE_CODE = lambda settings: settings.LANGUAGE_CODE
  1094. HELP_TOKENS_VERSION = lambda settings: doc_version()
  1095. derived('HELP_TOKENS_LANGUAGE_CODE', 'HELP_TOKENS_VERSION')
  1096. # This is required for the migrations in oauth_dispatch.models
  1097. # otherwise it fails saying this attribute is not present in Settings
  1098. # Although Studio does not exable OAuth2 Provider capability, the new approach
  1099. # to generating test databases will discover and try to create all tables
  1100. # and this setting needs to be present
  1101. OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application'
  1102. # Used with Email sending
  1103. RETRY_ACTIVATION_EMAIL_MAX_ATTEMPTS = 5
  1104. RETRY_ACTIVATION_EMAIL_TIMEOUT = 0.5
  1105. ############## DJANGO-USER-TASKS ##############
  1106. # How long until database records about the outcome of a task and its artifacts get deleted?
  1107. USER_TASKS_MAX_AGE = timedelta(days=7)
  1108. ############## Settings for the Enterprise App ######################
  1109. ENTERPRISE_ENROLLMENT_API_URL = LMS_ROOT_URL + LMS_ENROLLMENT_API_PATH
  1110. ENTERPRISE_SERVICE_WORKER_USERNAME = 'enterprise_worker'
  1111. ENTERPRISE_API_CACHE_TIMEOUT = 3600 # Value is in seconds
  1112. ############## Settings for the Discovery App ######################
  1113. COURSE_CATALOG_API_URL = None
  1114. ############################# Persistent Grades ####################################
  1115. # Queue to use for updating persistent grades
  1116. RECALCULATE_GRADES_ROUTING_KEY = LOW_PRIORITY_QUEUE
  1117. # Queue to use for updating grades due to grading policy change
  1118. POLICY_CHANGE_GRADES_ROUTING_KEY = LOW_PRIORITY_QUEUE
  1119. ############## Settings for CourseGraph ############################
  1120. COURSEGRAPH_JOB_QUEUE = LOW_PRIORITY_QUEUE
  1121. ###################### VIDEO IMAGE STORAGE ######################
  1122. VIDEO_IMAGE_DEFAULT_FILENAME = 'images/video-images/default_video_image.png'
  1123. VIDEO_IMAGE_SUPPORTED_FILE_FORMATS = {
  1124. '.bmp': 'image/bmp',
  1125. '.bmp2': 'image/x-ms-bmp', # PIL gives x-ms-bmp format
  1126. '.gif': 'image/gif',
  1127. '.jpg': 'image/jpeg',
  1128. '.jpeg': 'image/jpeg',
  1129. '.png': 'image/png'
  1130. }
  1131. VIDEO_IMAGE_MAX_FILE_SIZE_MB = '2 MB'
  1132. VIDEO_IMAGE_MIN_FILE_SIZE_KB = '2 KB'
  1133. VIDEO_IMAGE_MAX_WIDTH = 1280
  1134. VIDEO_IMAGE_MAX_HEIGHT = 720
  1135. VIDEO_IMAGE_MIN_WIDTH = 640
  1136. VIDEO_IMAGE_MIN_HEIGHT = 360
  1137. VIDEO_IMAGE_ASPECT_RATIO = 16 / 9.0
  1138. VIDEO_IMAGE_ASPECT_RATIO_TEXT = '16:9'
  1139. VIDEO_IMAGE_ASPECT_RATIO_ERROR_MARGIN = 0.1