common.py 100 KB
Newer Older
1
# -*- coding: utf-8 -*-
2 3 4 5
"""
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
6
FEATURES[...]. Modules that extend this one can change the feature
7 8 9
configuration in an environment specific config file and re-calculate those
values.

10
We should make a method that calls all these config methods so that you just
11
make one call at the end of your site-specific dev file to reset all the
12 13
dependent variables (like INSTALLED_APPS) for you.

14
Longer TODO:
15
1. Right now our treatment of static content in general and in particular
16 17
   course-specific static content is haphazard.
2. We should have a more disciplined approach to feature flagging, even if it
18
   just means that we stick them in a dict called FEATURES.
19
3. We need to handle configuration for multiple courses. This could be as
20 21
   multiple sites, but we do need a way to map their data assets.
"""
22 23 24

# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
25
# pylint: disable=wildcard-import, unused-import, unused-wildcard-import
26

27 28 29 30 31
# Pylint gets confused by path.py instances, which report themselves as class
# objects. As a result, pylint applies the wrong regex in validating names,
# and throws spurious errors. Therefore, we disable invalid-name checking.
# pylint: disable=invalid-name

32
import imp
33
import sys
34
import os
35

36
from path import Path as path
37
from warnings import simplefilter
38
from django.utils.translation import ugettext_lazy as _
39

40
from .discussionsettings import *
41
import dealer.git
42
from xmodule.modulestore.modulestore_settings import update_module_store_settings
43
from xmodule.modulestore.edit_info import EditInfoMixin
44
from xmodule.mixin import LicenseMixin
45
from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin
Calen Pennington committed
46

47
################################### FEATURES ###################################
48
# The display name of the platform to be used in templates/emails/etc.
49
PLATFORM_NAME = "Your Platform Name Here"
50
CC_MERCHANT_NAME = PLATFORM_NAME
51
# Shows up in the platform footer, eg "(c) COPYRIGHT_YEAR"
52
COPYRIGHT_YEAR = "2016"
53

54
PLATFORM_FACEBOOK_ACCOUNT = "http://www.facebook.com/YourPlatformFacebookAccount"
55
PLATFORM_TWITTER_ACCOUNT = "@YourPlatformTwitterAccount"
56

57
ENABLE_JASMINE = False
58

Arjun Singh committed
59 60 61 62
DISCUSSION_SETTINGS = {
    'MAX_COMMENT_DEPTH': 2,
}

63
LMS_ROOT_URL = "http://localhost:8000"
64

65
# Features
66
FEATURES = {
67
    'DISPLAY_DEBUG_INFO_TO_STAFF': True,
68
    'DISPLAY_HISTOGRAMS_TO_STAFF': False,  # For large courses this slows down courseware access for staff.
69

70 71
    'REROUTE_ACTIVATION_EMAIL': False,  # nonempty string = address for all activation emails
    'DEBUG_LEVEL': 0,  # 0 = lowest level, least verbose, 255 = max level, most verbose
72 73 74

    ## DO NOT SET TO True IN THIS FILE
    ## Doing so will cause all courses to be released on production
75
    'DISABLE_START_DATES': False,  # When True, all courses will be active, regardless of start date
76

77 78
    # for consistency in user-experience, keep the value of the following 3 settings
    # in sync with the corresponding ones in cms/envs/common.py
79
    'ENABLE_DISCUSSION_SERVICE': True,
80 81
    'ENABLE_TEXTBOOK': True,
    'ENABLE_STUDENT_NOTES': True,  # enables the student notes API and UI.
82

83
    # discussion home panel, which includes a subscription on/off setting for discussion digest emails.
84
    # this should remain off in production until digest notifications are online.
e0d committed
85
    'ENABLE_DISCUSSION_HOME_PANEL': False,
86

87 88 89 90 91 92 93
    # Set this to True if you want the discussion digest emails enabled automatically for new users.
    # This will be set on all new account registrations.
    # It is not recommended to enable this feature if ENABLE_DISCUSSION_HOME_PANEL is not enabled, since
    # subscribers who receive digests in that case will only be able to unsubscribe via links embedded
    # in their emails, and they will have no way to resubscribe.
    'ENABLE_DISCUSSION_EMAIL_DIGEST': False,

94
    'ENABLE_DJANGO_ADMIN_SITE': True,  # set true to enable django's admin site, even on prod (e.g. for course ops)
95 96
    'ENABLE_SQL_TRACKING_LOGS': False,
    'ENABLE_LMS_MIGRATION': False,
97
    'ENABLE_MANUAL_GIT_RELOAD': False,
98

99 100
    'ENABLE_MASQUERADE': True,  # allow course staff to change to student view of courseware

Carson Gee committed
101 102
    'ENABLE_SYSADMIN_DASHBOARD': False,  # sysadmin dashboard, to see what courses are loaded, to delete & load courses

103
    'DISABLE_LOGIN_BUTTON': False,  # used in systems where login is automatic, eg MIT SSL
104

105 106
    # extrernal access methods
    'AUTH_USE_OPENID': False,
107
    'AUTH_USE_CERTIFICATES': False,
108
    'AUTH_USE_OPENID_PROVIDER': False,
109 110
    # Even though external_auth is in common, shib assumes the LMS views / urls, so it should only be enabled
    # in LMS
111
    'AUTH_USE_SHIB': False,
112
    'AUTH_USE_CAS': False,
113 114 115 116

    # This flag disables the requirement of having to agree to the TOS for users registering
    # with Shib.  Feature was requested by Stanford's office of general counsel
    'SHIB_DISABLE_TOS': False,
117

118 119 120
    # Toggles OAuth2 authentication provider
    'ENABLE_OAUTH2_PROVIDER': False,

121 122 123 124 125 126 127
    # Allows to enable an API endpoint to serve XBlock view, used for example by external applications.
    # See jquey-xblock: https://github.com/edx-solutions/jquery-xblock
    'ENABLE_XBLOCK_VIEW_ENDPOINT': False,

    # Allows to configure the LMS to provide CORS headers to serve requests from other domains
    'ENABLE_CORS_HEADERS': False,

128 129
    # Can be turned off if course lists need to be hidden. Effects views and templates.
    'COURSES_ARE_BROWSABLE': True,
130

131 132
    # Enables ability to restrict enrollment in specific courses by the user account login method
    'RESTRICT_ENROLL_BY_REG_METHOD': False,
133

134
    # enable analytics server.
135 136
    # WARNING: THIS SHOULD ALWAYS BE SET TO FALSE UNDER NORMAL
    # LMS OPERATION. See analytics.py for details about what
137 138
    # this does.
    'RUN_AS_ANALYTICS_SERVER_ENABLED': False,
139

140 141
    # Flip to True when the YouTube iframe API breaks (again)
    'USE_YOUTUBE_OBJECT_API': False,
142

143
    # Give a UI to show a student's submission history in a problem by the
144
    # Staff Debug tool.
145 146
    'ENABLE_STUDENT_HISTORY_VIEW': True,

147
    # Provide a UI to allow users to submit feedback from the LMS (left-hand help modal)
148
    'ENABLE_FEEDBACK_SUBMISSION': False,
Ned Batchelder committed
149

150 151 152
    # Turn on a page that lets staff enter Python code to be run in the
    # sandbox, for testing whether it's enabled properly.
    'ENABLE_DEBUG_RUN_PYTHON': False,
153 154 155

    # Enable URL that shows information about the status of variuous services
    'ENABLE_SERVICE_STATUS': False,
156

157 158
    # Don't autoplay videos for students
    'AUTOPLAY_VIDEOS': False,
159

160 161
    # Enable instructor dash to submit background tasks
    'ENABLE_INSTRUCTOR_BACKGROUND_TASKS': True,
162

163
    # Enable instructor to assign individual due dates
164 165 166 167
    # Note: In order for this feature to work, you must also add
    # 'courseware.student_field_overrides.IndividualStudentOverrideProvider' to
    # the setting FIELD_OVERRIDE_PROVIDERS, in addition to setting this flag to
    # True.
168 169
    'INDIVIDUAL_DUE_DATES': False,

cewing committed
170 171
    # Enable Custom Courses for EdX
    'CUSTOM_COURSES_EDX': False,
172

173 174 175
    # Toggle to enable certificates of courses on dashboard
    'ENABLE_VERIFIED_CERTIFICATES': False,

176
    # for load testing
177
    'AUTOMATIC_AUTH_FOR_TESTING': False,
178

179
    # Toggle the availability of the shopping cart page
David Ormsbee committed
180
    'ENABLE_SHOPPING_CART': False,
181 182

    # Toggle storing detailed billing information
183
    'STORE_BILLING_INFO': False,
184 185 186

    # Enable flow for payments for course registration (DIFFERENT from verified student flow)
    'ENABLE_PAID_COURSE_REGISTRATION': False,
187

188 189 190
    # Enable the display of cosmetic course price display (set in course advanced settings)
    'ENABLE_COSMETIC_DISPLAY_PRICE': False,

191 192
    # Automatically approve student identity verification attempts
    'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': False,
193 194 195 196

    # Disable instructor dash buttons for downloading course data
    # when enrollment exceeds this number
    'MAX_ENROLLMENT_INSTR_BUTTONS': 200,
197

198 199 200
    # Grade calculation started from the instructor dashboard will write grades
    # CSV files to the configured storage backend and give links for downloads.
    'ENABLE_GRADE_DOWNLOADS': False,
201

202
    # whether to use password policy enforcement or not
203
    'ENFORCE_PASSWORD_POLICY': True,
204

205 206
    # Give course staff unrestricted access to grade downloads (if set to False,
    # only edX superusers can perform the downloads)
207
    'ALLOW_COURSE_STAFF_GRADE_DOWNLOADS': False,
Julia Hansbrough committed
208

209 210 211 212 213 214
    'ENABLED_PAYMENT_REPORTS': [
        "refund_report",
        "itemized_purchase_report",
        "university_revenue_share",
        "certificate_status"
    ],
215 216

    # Turn off account locking if failed login attempts exceeds a limit
217
    'ENABLE_MAX_FAILED_LOGIN_ATTEMPTS': True,
218 219

    # Hide any Personally Identifiable Information from application logs
220
    'SQUELCH_PII_IN_LOGS': True,
221

222 223
    # Toggles the embargo functionality, which blocks users from
    # the site or courses based on their location.
224
    'EMBARGO': False,
225 226 227 228 229

    # Whether the Wiki subsystem should be accessible via the direct /wiki/ paths. Setting this to True means
    # that people can submit content and modify the Wiki in any arbitrary manner. We're leaving this as True in the
    # defaults, so that we maintain current behavior
    'ALLOW_WIKI_ROOT_ACCESS': True,
230 231 232

    # Turn on/off Microsites feature
    'USE_MICROSITES': False,
233 234 235 236

    # Turn on third-party auth. Disabled for now because full implementations are not yet available. Remember to syncdb
    # if you enable this; we don't create tables by default.
    'ENABLE_THIRD_PARTY_AUTH': False,
237 238 239

    # Toggle to enable alternate urls for marketing links
    'ENABLE_MKTG_SITE': False,
240 241

    # Prevent concurrent logins per user
242
    'PREVENT_CONCURRENT_LOGINS': True,
243

244 245
    # Turn on Advanced Security by default
    'ADVANCED_SECURITY': True,
246

247 248 249 250 251
    # When a logged in user goes to the homepage ('/') should the user be
    # redirected to the dashboard - this is default Open edX behavior. Set to
    # False to not redirect the user
    'ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER': True,

252 253 254
    # When a user goes to the homepage ('/') the user see the
    # courses listed in the announcement dates order - this is default Open edX behavior.
    # Set to True to change the course sorting behavior by their start dates, latest first.
255
    'ENABLE_COURSE_SORTING_BY_START_DATE': True,
256

257
    # Expose Mobile REST API. Note that if you use this, you must also set
258 259 260
    # ENABLE_OAUTH2_PROVIDER to True
    'ENABLE_MOBILE_REST_API': False,

261 262
    # Enable the combined login/registration form
    'ENABLE_COMBINED_LOGIN_REGISTRATION': False,
263
    'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER': False,
264

265 266 267
    # Enable organizational email opt-in
    'ENABLE_MKTG_EMAIL_OPT_IN': False,

asadiqbal08 committed
268 269 270 271
    # Show a section in the membership tab of the instructor dashboard
    # to allow an upload of a CSV file that contains a list of new accounts to create
    # and register for course.
    'ALLOW_AUTOMATED_SIGNUPS': False,
272

273
    # Enable display of enrollment counts in instructor dash, analytics section
274
    'DISPLAY_ANALYTICS_ENROLLMENTS': True,
275

276 277
    # Show the mobile app links in the footer
    'ENABLE_FOOTER_MOBILE_APP_LINKS': False,
278

279
    # Let students save and manage their annotations
280
    'ENABLE_EDXNOTES': False,
281 282 283 284

    # Milestones application flag
    'MILESTONES_APP': False,

285 286 287
    # Organizations application flag
    'ORGANIZATIONS_APP': False,

288 289
    # Prerequisite courses feature flag
    'ENABLE_PREREQUISITE_COURSES': False,
290 291 292

    # For easily adding modes to courses during acceptance testing
    'MODE_CREATION_FOR_TESTING': False,
293 294 295

    # Courseware search feature
    'ENABLE_COURSEWARE_SEARCH': False,
296

297 298 299
    # Dashboard search feature
    'ENABLE_DASHBOARD_SEARCH': False,

300 301
    # log all information from cybersource callbacks
    'LOG_POSTPAY_CALLBACKS': True,
302 303 304

    # enable beacons for video timing statistics
    'ENABLE_VIDEO_BEACON': False,
305

306 307 308
    # enable beacons for lms onload event statistics
    'ENABLE_ONLOAD_BEACON': False,

309 310 311
    # Toggle platform-wide course licensing
    'LICENSING': False,

312 313
    # Certificates Web/HTML Views
    'CERTIFICATES_HTML_VIEW': False,
314

315 316 317
    # Batch-Generated Certificates from Instructor Dashboard
    'CERTIFICATES_INSTRUCTOR_GENERATION': False,

318 319
    # Course discovery feature
    'ENABLE_COURSE_DISCOVERY': False,
320

321 322 323
    # Setting for overriding default filtering facets for Course discovery
    # COURSE_DISCOVERY_FILTERS = ["org", "language", "modes"]

324 325
    # Software secure fake page feature flag
    'ENABLE_SOFTWARE_SECURE_FAKE': False,
326 327

    # Teams feature
328
    'ENABLE_TEAMS': True,
Alexander Kryklia committed
329 330 331 332 333 334 335

    # Show video bumper in LMS
    'ENABLE_VIDEO_BUMPER': False,

    # How many seconds to show the bumper again, default is 7 days:
    'SHOW_BUMPER_PERIODICITY': 7 * 24 * 3600,

336 337
    # Special Exams, aka Timed and Proctored Exams
    'ENABLE_SPECIAL_EXAMS': False,
338

339 340
    # Enable OpenBadge support. See the BADGR_* settings later in this file.
    'ENABLE_OPENBADGES': False,
341

342 343
    # Enable LTI Provider feature.
    'ENABLE_LTI_PROVIDER': False,
344

asadiqbal committed
345
    # Show Language selector.
346
    'SHOW_LANGUAGE_SELECTOR': False,
347 348 349 350 351 352 353 354 355 356 357

    # Write new CSM history to the extended table.
    # This will eventually default to True and may be
    # removed since all installs should have the separate
    # extended history table.
    'ENABLE_CSMH_EXTENDED': False,

    # Read from both the CSMH and CSMHE history tables.
    # This is the default, but can be disabled if all history
    # lives in the Extended table, saving the frontend from
    # making multiple queries.
358
    'ENABLE_READING_FROM_MULTIPLE_HISTORY_TABLES': True,
359 360
}

361 362 363
# Ignore static asset files on import which match this pattern
ASSET_IGNORE_REGEX = r"(^\._.*$)|(^\.DS_Store$)|(^.*~$)"

364 365 366 367 368 369
# Used for A/B testing
DEFAULT_GROUPS = []

# If this is true, random scores will be generated for the purpose of debugging the profile graphs
GENERATE_PROFILE_SCORES = False

370
# Used with XQueue
371
XQUEUE_WAITTIME_BETWEEN_REQUESTS = 5  # seconds
372

373

374
############################# SET PATH INFORMATION #############################
375
PROJECT_ROOT = path(__file__).abspath().dirname().dirname()  # /edx-platform/lms
376 377
REPO_ROOT = PROJECT_ROOT.dirname()
COMMON_ROOT = REPO_ROOT / "common"
378
ENV_ROOT = REPO_ROOT.dirname()  # virtualenv dir /edx-platform is in
379 380 381 382
COURSES_ROOT = ENV_ROOT / "data"

DATA_DIR = COURSES_ROOT

383
# TODO: Remove the rest of the sys.path modification here and in cms/envs/common.py
384
sys.path.append(REPO_ROOT)
385
sys.path.append(PROJECT_ROOT / 'djangoapps')
386
sys.path.append(COMMON_ROOT / 'djangoapps')
387

388
# For Node.js
389

390
system_node_path = os.environ.get("NODE_PATH", REPO_ROOT / 'node_modules')
391

392 393 394 395 396
node_paths = [
    COMMON_ROOT / "static/js/vendor",
    COMMON_ROOT / "static/coffee/src",
    system_node_path,
]
397
NODE_PATH = ':'.join(node_paths)
398

399 400
# For geolocation ip database
GEOIP_PATH = REPO_ROOT / "common/static/data/geoip/GeoIP.dat"
401
GEOIPV6_PATH = REPO_ROOT / "common/static/data/geoip/GeoIPv6.dat"
402

403
# Where to look for a status message
404
STATUS_MESSAGE_PATH = ENV_ROOT / "status_message.json"
405

406 407 408
############################ Global Database Configuration #####################

DATABASE_ROUTERS = [
409
    'openedx.core.lib.django_courseware_routers.StudentModuleHistoryExtendedRouter',
410 411
]

412
############################ OpenID Provider  ##################################
413
OPENID_PROVIDER_TRUSTED_ROOTS = ['cs50.net', '*.cs50.net']
414

415 416 417 418 419 420 421 422 423
############################ OAUTH2 Provider ###################################

# OpenID Connect issuer ID. Normally the URL of the authentication endpoint.

OAUTH_OIDC_ISSUER = 'https:/example.com/oauth2'

# OpenID Connect claim handlers

OAUTH_OIDC_ID_TOKEN_HANDLERS = (
424 425 426
    'edx_oauth2_provider.oidc.handlers.BasicIDTokenHandler',
    'edx_oauth2_provider.oidc.handlers.ProfileHandler',
    'edx_oauth2_provider.oidc.handlers.EmailHandler',
427 428 429 430
    'oauth2_handler.IDTokenHandler'
)

OAUTH_OIDC_USERINFO_HANDLERS = (
431 432 433
    'edx_oauth2_provider.oidc.handlers.BasicUserInfoHandler',
    'edx_oauth2_provider.oidc.handlers.ProfileHandler',
    'edx_oauth2_provider.oidc.handlers.EmailHandler',
434 435 436
    'oauth2_handler.UserInfoHandler'
)

437 438
OAUTH_EXPIRE_CONFIDENTIAL_CLIENT_DAYS = 365
OAUTH_EXPIRE_PUBLIC_CLIENT_DAYS = 30
439

440 441 442
################################## DJANGO OAUTH TOOLKIT #######################################

OAUTH2_PROVIDER = {
443 444 445 446 447 448 449
    'OAUTH2_VALIDATOR_CLASS': 'lms.djangoapps.oauth_dispatch.dot_overrides.EdxOAuth2Validator',
    'SCOPES': {
        'read': 'Read scope',
        'write': 'Write scope',
        'email': 'Email scope',
        'profile': 'Profile scope',
    }
450 451
}

452 453 454
################################## TEMPLATE CONFIGURATION #####################################
# Mako templating
# TODO: Move the Mako templating into a different engine in TEMPLATES below.
455 456
import tempfile
MAKO_MODULE_DIR = os.path.join(tempfile.gettempdir(), 'mako_lms')
Piotr Mitros committed
457
MAKO_TEMPLATES = {}
458
MAKO_TEMPLATES['main'] = [PROJECT_ROOT / 'templates',
459
                          COMMON_ROOT / 'templates',
460
                          COMMON_ROOT / 'lib' / 'capa' / 'capa' / 'templates',
461
                          COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates']
Piotr Mitros committed
462

463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
# Django templating
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        # Don't look for template source files inside installed applications.
        'APP_DIRS': False,
        # Instead, look for template source files in these dirs.
        'DIRS': [
            PROJECT_ROOT / "templates",
            COMMON_ROOT / 'templates',
            COMMON_ROOT / 'lib' / 'capa' / 'capa' / 'templates',
            COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates',
            COMMON_ROOT / 'static',  # required to statically include common Underscore templates
        ],
        # Options specific to this backend.
        'OPTIONS': {
            'loaders': [
480 481
                # We have to use mako-aware template loaders to be able to include
                # mako templates inside django templates (such as main_django.html).
482
                'openedx.core.djangoapps.theming.template_loaders.ThemeTemplateLoader',
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
                'edxmako.makoloader.MakoFilesystemLoader',
                'edxmako.makoloader.MakoAppDirectoriesLoader',
            ],
            'context_processors': [
                'django.template.context_processors.request',
                'django.template.context_processors.static',
                'django.contrib.messages.context_processors.messages',
                'django.template.context_processors.i18n',
                'django.contrib.auth.context_processors.auth',  # this is required for admin
                'django.template.context_processors.csrf',

                # Added for django-wiki
                'django.template.context_processors.media',
                'django.template.context_processors.tz',
                'django.contrib.messages.context_processors.messages',
                'sekizai.context_processors.sekizai',

                # Hack to get required link URLs to password reset templates
                'edxmako.shortcuts.marketing_link_context_processor',

                # Shoppingcart processor (detects if request.user has a cart)
                'shoppingcart.context_processor.user_has_cart_context_processor',

                # Allows the open edX footer to be leveraged in Django Templates.
507
                'edxmako.shortcuts.footer_context_processor',
508 509 510

                # Online contextual help
                'context_processors.doc_url',
511
                'openedx.core.djangoapps.site_configuration.context_processors.configuration_context'
512 513 514 515 516
            ],
            # Change 'debug' in your environment settings files - not here.
            'debug': False
        }
    }
517
]
518
DEFAULT_TEMPLATE_ENGINE = TEMPLATES[0]
519

520
###############################################################################################
521

Diana Huang committed
522 523 524 525
# use the ratelimit backend to prevent brute force attacks
AUTHENTICATION_BACKENDS = (
    'ratelimitbackend.backends.RateLimitModelBackend',
)
526
STUDENT_FILEUPLOAD_MAX_SIZE = 4 * 1000 * 1000  # 4 MB
527
MAX_FILEUPLOADS_PER_INPUT = 20
528

529 530
# Dev machines shouldn't need the book
# BOOK_URL = '/static/book/'
531
BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/'  # For AWS deploys
532
RSS_TIMEOUT = 600
533

534 535 536 537
# Configuration option for when we want to grab server error pages
STATIC_GRAB = False
DEV_CONTENT = True

538
EDX_ROOT_URL = ''
539

540 541
LOGIN_REDIRECT_URL = EDX_ROOT_URL + '/login'
LOGIN_URL = EDX_ROOT_URL + '/login'
542

543 544 545 546
COURSE_NAME = "6.002_Spring_2012"
COURSE_NUMBER = "6.002x"
COURSE_TITLE = "Circuits and Electronics"

547
### Dark code. Should be enabled in local settings for devel.
548

549
ENABLE_MULTICOURSE = False  # set to False to disable multicourse display (see lib.util.views.edXhome)
550

551 552
WIKI_ENABLED = False

553 554
###

555
COURSE_DEFAULT = '6.002x_Fall_2012'
Adam Palay committed
556 557 558 559 560 561 562 563
COURSE_SETTINGS = {
    '6.002x_Fall_2012': {
        'number': '6.002x',
        'title': 'Circuits and Electronics',
        'xmlpath': '6002x/',
        'location': 'i4x://edx/6002xs12/course/6.002x_Fall_2012',
    }
}
564

Victor Shnayder committed
565 566 567
# IP addresses that are allowed to reload the course, etc.
# TODO (vshnayder): Will probably need to change as we get real access control in.
LMS_MIGRATION_ALLOWED_IPS = []
568

569 570
# These are standard regexes for pulling out info like course_ids, usage_ids, etc.
# They are used so that URLs with deprecated-format strings still work.
571 572 573
# Note: these intentionally greedily grab all chars up to the next slash including any pluses
# DHM: I really wanted to ensure the separators were the same (+ or /) but all patts I tried had
# too many inadvertent side effects :-(
574
COURSE_KEY_PATTERN = r'(?P<course_key_string>[^/+]+(/|\+)[^/+]+(/|\+)[^/?]+)'
575
COURSE_ID_PATTERN = COURSE_KEY_PATTERN.replace('course_key_string', 'course_id')
576
COURSE_KEY_REGEX = COURSE_KEY_PATTERN.replace('P<course_key_string>', ':')
577

578 579 580 581
USAGE_KEY_PATTERN = r'(?P<usage_key_string>(?:i4x://?[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'
ASSET_KEY_PATTERN = r'(?P<asset_key_string>(?:/?c4x(:/)?/[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'
USAGE_ID_PATTERN = r'(?P<usage_id>(?:i4x://?[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'

muzaffaryousaf committed
582
USERNAME_PATTERN = r'(?P<username>[\w.@+-]+)'
583 584

############################## EVENT TRACKING #################################
585
LMS_SEGMENT_KEY = None
586 587

# FIXME: Should we be doing this truncation?
588
TRACK_MAX_EVENT = 50000
589 590 591 592 593 594 595 596 597 598 599 600

DEBUG_TRACK_LOG = False

TRACKING_BACKENDS = {
    'logger': {
        'ENGINE': 'track.backends.logger.LoggerBackend',
        'OPTIONS': {
            'name': 'tracking'
        }
    }
}

601 602
# We're already logging events, and we don't want to capture user
# names/passwords.  Heartbeat events are likely not interesting.
603
TRACKING_IGNORE_URL_PATTERNS = [r'^/event', r'^/login', r'^/heartbeat', r'^/segmentio/event', r'^/performance']
604 605 606

EVENT_TRACKING_ENABLED = True
EVENT_TRACKING_BACKENDS = {
607 608
    'tracking_logs': {
        'ENGINE': 'eventtracking.backends.routing.RoutingBackend',
609
        'OPTIONS': {
610 611 612 613 614 615 616 617 618 619 620
            'backends': {
                'logger': {
                    'ENGINE': 'eventtracking.backends.logger.LoggerBackend',
                    'OPTIONS': {
                        'name': 'tracking',
                        'max_event_size': TRACK_MAX_EVENT,
                    }
                }
            },
            'processors': [
                {'ENGINE': 'track.shim.LegacyFieldMappingProcessor'},
621
                {'ENGINE': 'track.shim.PrefixedEventProcessor'}
622
            ]
623
        }
624
    },
625 626 627 628 629 630 631 632 633 634 635 636
    'segmentio': {
        'ENGINE': 'eventtracking.backends.routing.RoutingBackend',
        'OPTIONS': {
            'backends': {
                'segment': {'ENGINE': 'eventtracking.backends.segment.SegmentBackend'}
            },
            'processors': [
                {
                    'ENGINE': 'eventtracking.processors.whitelist.NameWhitelistProcessor',
                    'OPTIONS': {
                        'whitelist': []
                    }
637 638 639
                },
                {
                    'ENGINE': 'track.shim.GoogleAnalyticsProcessor'
640 641 642
                }
            ]
        }
643
    }
644 645
}
EVENT_TRACKING_PROCESSORS = []
646

647
# Backwards compatibility with ENABLE_SQL_TRACKING_LOGS feature flag.
648
# In the future, adding the backend to TRACKING_BACKENDS should be enough.
649
if FEATURES.get('ENABLE_SQL_TRACKING_LOGS'):
650 651 652 653 654
    TRACKING_BACKENDS.update({
        'sql': {
            'ENGINE': 'track.backends.django.DjangoBackend'
        }
    })
655 656 657 658 659
    EVENT_TRACKING_BACKENDS.update({
        'sql': {
            'ENGINE': 'track.backends.django.DjangoBackend'
        }
    })
660

661
TRACKING_SEGMENTIO_WEBHOOK_SECRET = None
662
TRACKING_SEGMENTIO_ALLOWED_TYPES = ['track']
663
TRACKING_SEGMENTIO_DISALLOWED_SUBSTRING_NAMES = ['.bi.']
664 665 666 667
TRACKING_SEGMENTIO_SOURCE_MAP = {
    'analytics-android': 'mobile',
    'analytics-ios': 'mobile',
}
668

669
######################## GOOGLE ANALYTICS ###########################
670
GOOGLE_ANALYTICS_ACCOUNT = None
671 672
GOOGLE_ANALYTICS_LINKEDIN = 'GOOGLE_ANALYTICS_LINKEDIN_DUMMY'

673 674 675
######################## OPTIMIZELY ###########################
OPTIMIZELY_PROJECT_ID = None

676 677
######################## subdomain specific settings ###########################
COURSE_LISTINGS = {}
678
VIRTUAL_UNIVERSITIES = []
679

Calen Pennington committed
680 681
############# XBlock Configuration ##########

682 683 684 685 686
# Import after sys.path fixup
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.modulestore import prefer_xmodules
from xmodule.x_module import XModuleMixin

687
# These are the Mixins that should be added to every XBlock.
Calen Pennington committed
688 689
# This should be moved into an XBlock Runtime/Application object
# once the responsibility of XBlock creation is moved out of modulestore - cpennington
690
XBLOCK_MIXINS = (LmsBlockMixin, InheritanceMixin, XModuleMixin, EditInfoMixin)
Calen Pennington committed
691

692 693
# Allow any XBlock in the LMS
XBLOCK_SELECT_FUNCTION = prefer_xmodules
694

695 696 697
# Paths to wrapper methods which should be applied to every XBlock's FieldData.
XBLOCK_FIELD_DATA_WRAPPERS = ()

698 699
############# ModuleStore Configuration ##########

Nimisha Asthagiri committed
700
MODULESTORE_BRANCH = 'published-only'
701 702 703 704 705
CONTENTSTORE = None
DOC_STORE_CONFIG = {
    'host': 'localhost',
    'db': 'xmodule',
    'collection': 'modulestore',
706 707 708
    # If 'asset_collection' defined, it'll be used
    # as the collection name for asset metadata.
    # Otherwise, a default collection name will be used.
709 710 711 712 713 714 715 716
}
MODULESTORE = {
    'default': {
        'ENGINE': 'xmodule.modulestore.mixed.MixedModuleStore',
        'OPTIONS': {
            'mappings': {},
            'stores': [
                {
cahrens committed
717 718
                    'NAME': 'split',
                    'ENGINE': 'xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore',
719 720 721 722 723 724 725 726
                    'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
                    'OPTIONS': {
                        'default_class': 'xmodule.hidden_module.HiddenDescriptor',
                        'fs_root': DATA_DIR,
                        'render_template': 'edxmako.shortcuts.render_to_string',
                    }
                },
                {
cahrens committed
727 728 729
                    'NAME': 'draft',
                    'ENGINE': 'xmodule.modulestore.mongo.DraftMongoModuleStore',
                    'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
730 731
                    'OPTIONS': {
                        'default_class': 'xmodule.hidden_module.HiddenDescriptor',
cahrens committed
732 733
                        'fs_root': DATA_DIR,
                        'render_template': 'edxmako.shortcuts.render_to_string',
734
                    }
cahrens committed
735
                }
736 737 738 739 740
            ]
        }
    }
}

741 742 743 744 745 746 747
#################### Python sandbox ############################################

CODE_JAIL = {
    # Path to a sandboxed Python executable.  None means don't bother.
    'python_bin': None,
    # User to run as in the sandbox.
    'user': 'sandbox',
748 749 750 751 752 753

    # Configurable limits.
    'limits': {
        # How many CPU seconds can jailed code use?
        'CPU': 1,
    },
754 755
}

756 757 758 759 760 761 762 763 764
# Some courses are allowed to run unsafe code. This is a list of regexes, one
# of them must match the course id for that course to run unsafe code.
#
# For example:
#
#   COURSES_WITH_UNSAFE_CODE = [
#       r"Harvard/XY123.1/.*"
#   ]
COURSES_WITH_UNSAFE_CODE = []
765

766
############################### DJANGO BUILT-INS ###############################
767
# Change DEBUG in your environment settings files, not here
768
DEBUG = False
769
USE_TZ = True
770
SESSION_COOKIE_SECURE = False
771
SESSION_SAVE_EVERY_REQUEST = False
772
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
773

774 775 776
# CMS base
CMS_BASE = 'localhost:8001'

777
# Site info
778
SITE_NAME = "example.com"
779
HTTPS = 'on'
780
ROOT_URLCONF = 'lms.urls'
781
# NOTE: Please set ALLOWED_HOSTS to some sane value, as we do not allow the default '*'
782

783
# Platform Email
784
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
785 786 787 788 789 790
DEFAULT_FROM_EMAIL = 'registration@example.com'
DEFAULT_FEEDBACK_EMAIL = 'feedback@example.com'
SERVER_EMAIL = 'devops@example.com'
TECH_SUPPORT_EMAIL = 'technical@example.com'
CONTACT_EMAIL = 'info@example.com'
BUGS_EMAIL = 'bugs@example.com'
791 792
UNIVERSITY_EMAIL = 'university@example.com'
PRESS_EMAIL = 'press@example.com'
793
FINANCE_EMAIL = ''
794 795 796 797

# Platform mailing address
CONTACT_MAILING_ADDRESS = ''

798
ADMINS = ()
799 800
MANAGERS = ADMINS

801 802 803
EDX_PLATFORM_REVISION = os.environ.get('EDX_PLATFORM_REVISION')

if not EDX_PLATFORM_REVISION:
804 805 806 807 808 809
    try:
        # Get git revision of the current file
        EDX_PLATFORM_REVISION = dealer.git.Backend(path=REPO_ROOT).revision
    except TypeError:
        # Not a git repository
        EDX_PLATFORM_REVISION = 'unknown'
810

811
# Static content
812
STATIC_URL = '/static/'
813
STATIC_ROOT = ENV_ROOT / "staticfiles"
814

815
STATICFILES_DIRS = [
816
    COMMON_ROOT / "static",
817
    PROJECT_ROOT / "static",
818
]
819

820
FAVICON_PATH = 'images/favicon.ico'
821
DEFAULT_COURSE_ABOUT_IMAGE_URL = 'images/pencils.jpg'
822

823 824 825 826
# User-uploaded content
MEDIA_ROOT = '/edx/var/edxapp/media/'
MEDIA_URL = '/media/'

827
# Locale/Internationalization
828 829
TIME_ZONE = 'America/New_York'  # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
LANGUAGE_CODE = 'en'  # http://www.i18nguy.com/unicode/language-identifiers.html
830
# these languages display right to left
831
LANGUAGES_BIDI = ("he", "ar", "fa", "ur", "fa-ir", "rtl")
832

833
# Sourced from http://www.localeplanet.com/icu/ and wikipedia
834
LANGUAGES = (
835
    ('en', u'English'),
836
    ('rtl', u'Right-to-Left Test Language'),
837
    ('eo', u'Dummy Language (Esperanto)'),  # Dummy languaged used for testing
838
    ('fake2', u'Fake translations'),        # Another dummy language for testing (not pushed to prod)
839

Sarina Canelake committed
840
    ('am', u'አማርኛ'),  # Amharic
841
    ('ar', u'العربية'),  # Arabic
842 843 844
    ('az', u'azərbaycanca'),  # Azerbaijani
    ('bg-bg', u'български (България)'),  # Bulgarian (Bulgaria)
    ('bn-bd', u'বাংলা (বাংলাদেশ)'),  # Bengali (Bangladesh)
Sarina Canelake committed
845
    ('bn-in', u'বাংলা (ভারত)'),  # Bengali (India)
846
    ('bs', u'bosanski'),  # Bosnian
847
    ('ca', u'Català'),  # Catalan
848
    ('ca@valencia', u'Català (València)'),  # Catalan (Valencia)
849
    ('cs', u'Čeština'),  # Czech
850
    ('cy', u'Cymraeg'),  # Welsh
Sarina Canelake committed
851
    ('da', u'dansk'),  # Danish
852
    ('de-de', u'Deutsch (Deutschland)'),  # German (Germany)
853
    ('el', u'Ελληνικά'),  # Greek
854
    ('en-uk', u'English (United Kingdom)'),  # English (United Kingdom)
855 856 857
    ('en@lolcat', u'LOLCAT English'),  # LOLCAT English
    ('en@pirate', u'Pirate English'),  # Pirate English
    ('es-419', u'Español (Latinoamérica)'),  # Spanish (Latin America)
858 859
    ('es-ar', u'Español (Argentina)'),  # Spanish (Argentina)
    ('es-ec', u'Español (Ecuador)'),  # Spanish (Ecuador)
860
    ('es-es', u'Español (España)'),  # Spanish (Spain)
861 862 863 864 865 866 867
    ('es-mx', u'Español (México)'),  # Spanish (Mexico)
    ('es-pe', u'Español (Perú)'),  # Spanish (Peru)
    ('et-ee', u'Eesti (Eesti)'),  # Estonian (Estonia)
    ('eu-es', u'euskara (Espainia)'),  # Basque (Spain)
    ('fa', u'فارسی'),  # Persian
    ('fa-ir', u'فارسی (ایران)'),  # Persian (Iran)
    ('fi-fi', u'Suomi (Suomi)'),  # Finnish (Finland)
868
    ('fil', u'Filipino'),  # Filipino
869
    ('fr', u'Français'),  # French
870
    ('gl', u'Galego'),  # Galician
Sarina Canelake committed
871
    ('gu', u'ગુજરાતી'),  # Gujarati
872
    ('he', u'עברית'),  # Hebrew
873
    ('hi', u'हिन्दी'),  # Hindi
Sarina Canelake committed
874
    ('hr', u'hrvatski'),  # Croatian
875
    ('hu', u'magyar'),  # Hungarian
876
    ('hy-am', u'Հայերեն (Հայաստան)'),  # Armenian (Armenia)
877 878
    ('id', u'Bahasa Indonesia'),  # Indonesian
    ('it-it', u'Italiano (Italia)'),  # Italian (Italy)
Sarina Canelake committed
879
    ('ja-jp', u'日本語 (日本)'),  # Japanese (Japan)
880 881
    ('kk-kz', u'қазақ тілі (Қазақстан)'),  # Kazakh (Kazakhstan)
    ('km-kh', u'ភាសាខ្មែរ (កម្ពុជា)'),  # Khmer (Cambodia)
Sarina Canelake committed
882
    ('kn', u'ಕನ್ನಡ'),  # Kannada
Sarina Canelake committed
883
    ('ko-kr', u'한국어 (대한민국)'),  # Korean (Korea)
884
    ('lt-lt', u'Lietuvių (Lietuva)'),  # Lithuanian (Lithuania)
885 886
    ('ml', u'മലയാളം'),  # Malayalam
    ('mn', u'Монгол хэл'),  # Mongolian
887
    ('mr', u'मराठी'),  # Marathi
888
    ('ms', u'Bahasa Melayu'),  # Malay
889
    ('nb', u'Norsk bokmål'),  # Norwegian Bokmål
890
    ('ne', u'नेपाली'),  # Nepali
891
    ('nl-nl', u'Nederlands (Nederland)'),  # Dutch (Netherlands)
Sarina Canelake committed
892
    ('or', u'ଓଡ଼ିଆ'),  # Oriya
893 894
    ('pl', u'Polski'),  # Polish
    ('pt-br', u'Português (Brasil)'),  # Portuguese (Brazil)
895
    ('pt-pt', u'Português (Portugal)'),  # Portuguese (Portugal)
Sarina Canelake committed
896
    ('ro', u'română'),  # Romanian
897 898 899
    ('ru', u'Русский'),  # Russian
    ('si', u'සිංහල'),  # Sinhala
    ('sk', u'Slovenčina'),  # Slovak
900
    ('sl', u'Slovenščina'),  # Slovenian
901
    ('sq', u'shqip'),  # Albanian
902
    ('sr', u'Српски'),  # Serbian
903 904
    ('sv', u'svenska'),  # Swedish
    ('sw', u'Kiswahili'),  # Swahili
Sarina Canelake committed
905
    ('ta', u'தமிழ்'),  # Tamil
906
    ('te', u'తెలుగు'),  # Telugu
907
    ('th', u'ไทย'),  # Thai
908
    ('tr-tr', u'Türkçe (Türkiye)'),  # Turkish (Turkey)
909
    ('uk', u'Українська'),  # Ukranian
910
    ('ur', u'اردو'),  # Urdu
911
    ('vi', u'Tiếng Việt'),  # Vietnamese
912
    ('uz', u'Ўзбек'),  # Uzbek
Sarina Canelake committed
913
    ('zh-cn', u'中文 (简体)'),  # Chinese (China)
914
    ('zh-hk', u'中文 (香港)'),  # Chinese (Hong Kong)
Sarina Canelake committed
915
    ('zh-tw', u'中文 (台灣)'),  # Chinese (Taiwan)
916 917
)

918 919
LANGUAGE_DICT = dict(LANGUAGES)

920
USE_I18N = True
921
USE_L10N = True
922

923 924 925
STATICI18N_ROOT = PROJECT_ROOT / "static"
STATICI18N_OUTPUT_DIR = "js/i18n"

926 927
# Localization strings (e.g. django.po) are under this directory
LOCALE_PATHS = (REPO_ROOT + '/conf/locale',)  # edx-platform/conf/locale/
928 929 930
# Messages
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'

931
# Guidelines for translators
932
TRANSLATORS_GUIDE = 'http://edx.readthedocs.org/projects/edx-developer-guide/en/latest/conventions/internationalization/i18n_translators_guide.html'  # pylint: disable=line-too-long
933

934 935 936 937
#################################### GITHUB #######################################
# gitreload is used in LMS-workflow to pull content from github
# gitreload requests are only allowed from these IP addresses, which are
# the advertised public IPs of the github WebHook servers.
938
# These are listed, eg at https://github.com/edx/edx-platform/admin/hooks
939

940
ALLOWED_GITRELOAD_IPS = ['207.97.227.253', '50.57.128.197', '108.171.174.178']
941

942
#################################### AWS #######################################
943
# S3BotoStorage insists on a timeout for uploaded assets. We should make it
944
# permanent instead, but rather than trying to figure out exactly where that
945
# setting is, I'm just bumping the expiration time to something absurd (100
946 947
# years). This is only used if DEFAULT_FILE_STORAGE is overriden to use S3
# in the global settings.py
948
AWS_QUERYSTRING_EXPIRE = 10 * 365 * 24 * 60 * 60  # 10 years
949

950
################################# SIMPLEWIKI ###################################
951 952
SIMPLE_WIKI_REQUIRE_LOGIN_EDIT = True
SIMPLE_WIKI_REQUIRE_LOGIN_VIEW = False
953

954
################################# WIKI ###################################
955 956
from course_wiki import settings as course_wiki_settings

957
WIKI_ACCOUNT_HANDLING = False
958
WIKI_EDITOR = 'course_wiki.editors.CodeMirror'
959 960
WIKI_SHOW_MAX_CHILDREN = 0  # We don't use the little menu that shows children of an article in the breadcrumb
WIKI_ANONYMOUS = False  # Don't allow anonymous access until the styling is figured out
961 962 963 964 965

WIKI_CAN_DELETE = course_wiki_settings.CAN_DELETE
WIKI_CAN_MODERATE = course_wiki_settings.CAN_MODERATE
WIKI_CAN_CHANGE_PERMISSIONS = course_wiki_settings.CAN_CHANGE_PERMISSIONS
WIKI_CAN_ASSIGN = course_wiki_settings.CAN_ASSIGN
966 967

WIKI_USE_BOOTSTRAP_SELECT_WIDGET = False
968
WIKI_LINK_LIVE_LOOKUPS = False
969
WIKI_LINK_DEFAULT_LEVEL = 2
970

971 972 973 974 975 976 977 978
##### Feedback submission mechanism #####
FEEDBACK_SUBMISSION_EMAIL = None

##### Zendesk #####
ZENDESK_URL = None
ZENDESK_USER = None
ZENDESK_API_KEY = None

979 980 981
##### EMBARGO #####
EMBARGO_SITE_REDIRECT_URL = None

982
##### shoppingcart Payment #####
983
PAYMENT_SUPPORT_EMAIL = 'payment@example.com'
984

985
##### Using cybersource by default #####
986 987

CC_PROCESSOR_NAME = 'CyberSource'
988
CC_PROCESSOR = {
989
    'CyberSource': {
990
        'SHARED_SECRET': '',
991 992
        'MERCHANT_ID': '',
        'SERIAL_NUMBER': '',
993 994
        'ORDERPAGE_VERSION': '7',
        'PURCHASE_ENDPOINT': '',
995 996 997 998 999 1000
    },
    'CyberSource2': {
        "PURCHASE_ENDPOINT": '',
        "SECRET_KEY": '',
        "ACCESS_KEY": '',
        "PROFILE_ID": '',
1001
    }
1002
}
1003

1004 1005
# Setting for PAID_COURSE_REGISTRATION, DOES NOT AFFECT VERIFIED STUDENTS
PAID_COURSE_REGISTRATION_CURRENCY = ['usd', '$']
1006 1007 1008 1009

# Members of this group are allowed to generate payment reports
PAYMENT_REPORT_GENERATOR_GROUP = 'shoppingcart_report_access'

1010 1011 1012
################################# EdxNotes config  #########################

# Configure the LMS to use our stub EdxNotes implementation
1013 1014
EDXNOTES_PUBLIC_API = 'http://localhost:8120/api/v1'
EDXNOTES_INTERNAL_API = 'http://localhost:8120/api/v1'
1015

1016 1017 1018
EDXNOTES_CONNECT_TIMEOUT = 0.5  # time in seconds
EDXNOTES_READ_TIMEOUT = 1.5  # time in seconds

1019 1020 1021 1022 1023 1024
########################## Parental controls config  #######################

# The age at which a learner no longer requires parental consent, or None
# if parental consent is never required.
PARENTAL_CONSENT_AGE_LIMIT = 13

1025
################################# Jasmine ##################################
1026
JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee'
1027

1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046

######################### Branded Footer ###################################
# Constants for the footer used on the site and shared with other sites
# (such as marketing and the blog) via the branding API.

# URL for OpenEdX displayed in the footer
FOOTER_OPENEDX_URL = "http://open.edx.org"

# URL for the OpenEdX logo image
# We use logo images served from files.edx.org so we can (roughly) track
# how many OpenEdX installations are running.
# Site operators can choose from these logo options:
# * https://files.edx.org/openedx-logos/edx-openedx-logo-tag.png
# * https://files.edx.org/openedx-logos/edx-openedx-logo-tag-light.png"
# * https://files.edx.org/openedx-logos/edx-openedx-logo-tag-dark.png
FOOTER_OPENEDX_LOGO_IMAGE = "https://files.edx.org/openedx-logos/edx-openedx-logo-tag.png"

# This is just a placeholder image.
# Site operators can customize this with their organization's image.
1047
FOOTER_ORGANIZATION_IMAGE = "images/logo.png"
1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069

# These are referred to both by the Django asset pipeline
# AND by the branding footer API, which needs to decide which
# version of the CSS to serve.
FOOTER_CSS = {
    "openedx": {
        "ltr": "style-lms-footer",
        "rtl": "style-lms-footer-rtl",
    },
    "edx": {
        "ltr": "style-lms-footer-edx",
        "rtl": "style-lms-footer-edx-rtl",
    },
}

# Cache expiration for the version of the footer served
# by the branding API.
FOOTER_CACHE_TIMEOUT = 30 * 60

# Max age cache control header for the footer (controls browser caching).
FOOTER_BROWSER_CACHE_MAX_AGE = 5 * 60

1070 1071 1072
# Credit api notification cache timeout
CREDIT_NOTIFICATION_CACHE_TIMEOUT = 5 * 60 * 60

1073 1074 1075 1076 1077
################################# Deprecation warnings #####################

# Ignore deprecation warnings (so we don't clutter Jenkins builds/production)
simplefilter('ignore')

1078 1079 1080
################################# Middleware ###################################

MIDDLEWARE_CLASSES = (
1081 1082
    'crum.CurrentRequestUserMiddleware',

1083
    'request_cache.middleware.RequestCache',
1084

1085
    'mobile_api.middleware.AppVersionUpgrade',
1086
    'header_control.middleware.HeaderControlMiddleware',
1087
    'microsite_configuration.middleware.MicrositeMiddleware',
Rocky Duan committed
1088
    'django_comment_client.middleware.AjaxExceptionMiddleware',
1089
    'django.middleware.common.CommonMiddleware',
1090 1091 1092 1093
    'django.contrib.sites.middleware.CurrentSiteMiddleware',

    # Allows us to define redirects via Django admin
    'django_sites_extensions.middleware.RedirectMiddleware',
1094 1095 1096 1097

    # Instead of SessionMiddleware, we use a more secure version
    # 'django.contrib.sessions.middleware.SessionMiddleware',
    'openedx.core.djangoapps.safe_sessions.middleware.SafeSessionMiddleware',
1098 1099

    # Instead of AuthenticationMiddleware, we use a cached backed version
1100 1101
    #'django.contrib.auth.middleware.AuthenticationMiddleware',
    'cache_toolbox.middleware.CacheBackedAuthenticationMiddleware',
1102 1103 1104
    # Enable SessionAuthenticationMiddleware in order to invalidate
    # user sessions after a password change.
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
1105

1106
    'student.middleware.UserStandingMiddleware',
1107
    'contentserver.middleware.StaticContentServer',
1108

1109 1110
    # Adds user tags to tracking events
    # Must go before TrackMiddleware, to get the context set up
1111
    'openedx.core.djangoapps.user_api.middleware.UserTagsEventContextMiddleware',
1112

1113 1114
    'django.contrib.messages.middleware.MessageMiddleware',
    'track.middleware.TrackMiddleware',
Will Daly committed
1115 1116 1117 1118 1119

    # CORS and CSRF
    'corsheaders.middleware.CorsMiddleware',
    'cors_csrf.middleware.CorsCSRFMiddleware',
    'cors_csrf.middleware.CsrfCrossDomainCookieMiddleware',
1120
    'django.middleware.csrf.CsrfViewMiddleware',
Will Daly committed
1121

1122
    'splash.middleware.SplashMiddleware',
1123

1124

1125
    'geoinfo.middleware.CountryMiddleware',
1126
    'embargo.middleware.EmbargoMiddleware',
1127

1128
    # Allows us to set user preferences
1129
    'lang_pref.middleware.LanguagePreferenceMiddleware',
1130

1131 1132 1133 1134 1135 1136 1137
    # Allows us to dark-launch particular languages.
    # Must be after LangPrefMiddleware, so ?preview-lang query params can override
    # user's language preference. ?clear-lang resets to user's language preference.
    'dark_lang.middleware.DarkLangMiddleware',

    # Detects user-requested locale from 'accept-language' header in http request.
    # Must be after DarkLangMiddleware.
1138
    'django.middleware.locale.LocaleMiddleware',
1139

1140
    # 'debug_toolbar.middleware.DebugToolbarMiddleware',
1141 1142

    'django_comment_client.utils.ViewNameMiddleware',
1143
    'codejail.django_integration.ConfigureCodeJailMiddleware',
Diana Huang committed
1144 1145 1146

    # catches any uncaught RateLimitExceptions and returns a 403 instead of a 500
    'ratelimitbackend.middleware.RateLimitMiddleware',
1147

1148 1149
    # for expiring inactive sessions
    'session_inactivity_timeout.middleware.SessionInactivityTimeout',
1150

1151 1152
    # use Django built in clickjacking protection
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
1153

1154 1155 1156
    # to redirected unenrolled students to the course info page
    'courseware.middleware.RedirectUnenrolledMiddleware',

1157
    'course_wiki.middleware.WikiAccessMiddleware',
1158

1159 1160
    'openedx.core.djangoapps.theming.middleware.CurrentSiteThemeMiddleware',

1161 1162
    # This must be last
    'microsite_configuration.middleware.MicrositeSessionCookieDomainMiddleware',
1163 1164
)

1165 1166 1167
# Clickjacking protection can be enabled by setting this to 'DENY'
X_FRAME_OPTIONS = 'ALLOW'

1168 1169 1170
# Platform for Privacy Preferences header
P3P_HEADER = 'CP="Open EdX does not have a P3P policy."'

1171
############################### PIPELINE #######################################
1172

1173 1174
PIPELINE_ENABLED = True

1175
STATICFILES_STORAGE = 'openedx.core.storage.ProductionStorage'
1176

1177 1178 1179
# List of finder classes that know how to find static files in various locations.
# Note: the pipeline finder is included to be able to discover optimized files
STATICFILES_FINDERS = [
1180
    'openedx.core.djangoapps.theming.finders.ThemeFilesFinder',
1181 1182
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
1183
    'openedx.core.lib.xblock_pipeline.finder.XBlockPipelineFinder',
1184 1185 1186 1187
    'pipeline.finders.PipelineFinder',
]

PIPELINE_CSS_COMPRESSOR = None
1188
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.uglifyjs.UglifyJSCompressor'
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198

# Setting that will only affect the edX version of django-pipeline until our changes are merged upstream
PIPELINE_COMPILE_INPLACE = True

# Don't wrap JavaScript as there is code that depends upon updating the global namespace
PIPELINE_DISABLE_WRAPPER = True

# Specify the UglifyJS binary to use
PIPELINE_UGLIFYJS_BINARY = 'node_modules/.bin/uglifyjs'

1199
from openedx.core.lib.rooted_paths import rooted_glob
1200

1201 1202
courseware_js = (
    [
1203
        'coffee/src/' + pth + '.js'
cahrens committed
1204
        for pth in ['courseware', 'histogram', 'navigation']
1205
    ] +
1206
    ['js/' + pth + '.js' for pth in ['ajax-error']] +
1207
    sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/modules/**/*.js'))
1208
)
1209

1210
proctoring_js = (
1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230
    [
        'proctoring/js/models/proctored_exam_allowance_model.js',
        'proctoring/js/models/proctored_exam_attempt_model.js',
        'proctoring/js/models/proctored_exam_model.js'
    ] +
    [
        'proctoring/js/collections/proctored_exam_allowance_collection.js',
        'proctoring/js/collections/proctored_exam_attempt_collection.js',
        'proctoring/js/collections/proctored_exam_collection.js'
    ] +
    [
        'proctoring/js/views/Backbone.ModalDialog.js',
        'proctoring/js/views/proctored_exam_add_allowance_view.js',
        'proctoring/js/views/proctored_exam_allowance_view.js',
        'proctoring/js/views/proctored_exam_attempt_view.js',
        'proctoring/js/views/proctored_exam_view.js'
    ] +
    [
        'proctoring/js/proctored_app.js'
    ]
1231
)
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242

# Before a student accesses courseware, we do not
# need many of the JS dependencies.  This includes
# only the dependencies used everywhere in the LMS
# (including the dashboard/account/profile pages)
# Currently, this partially duplicates the "main vendor"
# JavaScript file, so only one of the two should be included
# on a page at any time.
# In the future, we will likely refactor this to use
# RequireJS and an optimizer.
base_vendor_js = [
1243 1244
    'common/js/vendor/jquery.js',
    'common/js/vendor/jquery-migrate.js',
1245
    'js/vendor/jquery.cookie.js',
1246
    'js/vendor/url.min.js',
1247
    'common/js/vendor/underscore.js',
1248
    'common/js/vendor/underscore.string.js',
1249
    'common/js/vendor/picturefill.js',
1250 1251 1252 1253 1254 1255 1256

    # 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',

    # Finally load RequireJS and dependent vendor libraries
Andy Armstrong committed
1257
    'js/vendor/requirejs/require.js',
1258
    'js/RequireJS-namespace-undefine.js',
1259
    'js/vendor/URI.min.js',
1260
    'common/js/vendor/backbone.js'
1261 1262 1263
]

main_vendor_js = base_vendor_js + [
1264 1265 1266 1267
    'js/vendor/json2.js',
    'js/vendor/jquery-ui.min.js',
    'js/vendor/jquery.qtip.min.js',
    'js/vendor/jquery.ba-bbq.min.js',
1268 1269 1270 1271 1272 1273
]

# Common files used by both RequireJS code and non-RequireJS code
base_application_js = [
    'js/src/utility.js',
    'js/src/logger.js',
1274
    'js/my_courses_dropdown.js',
1275
    'js/dialog_tab_controls.js',
1276 1277 1278 1279
    'js/src/string_utils.js',
    'js/form.ext.js',
    'js/src/ie_shim.js',
    'js/src/accessibility_tools.js',
1280
    'js/toggle_login_modal.js',
1281
    'js/src/lang_edx.js',
1282
]
1283

1284
dashboard_js = (
1285
    sorted(rooted_glob(PROJECT_ROOT / 'static', 'js/dashboard/**/*.js'))
1286
)
1287 1288 1289 1290
discussion_js = (
    rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/customwmd.js') +
    rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/mathjax_accessible.js') +
    rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/mathjax_delay_renderer.js') +
1291
    sorted(rooted_glob(COMMON_ROOT / 'static', 'common/js/discussion/**/*.js'))
1292
)
1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304

discussion_vendor_js = [
    'js/Markdown.Converter.js',
    'js/Markdown.Sanitizer.js',
    'js/Markdown.Editor.js',
    'js/vendor/jquery.timeago.js',
    'js/src/jquery.timeago.locale.js',
    'js/vendor/jquery.truncate.js',
    'js/jquery.ajaxfileupload.js',
    'js/split.js'
]

daniel cebrian committed
1305
notes_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/notes/**/*.js'))
1306 1307 1308 1309
instructor_dash_js = (
    sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/instructor_dashboard/**/*.js')) +
    sorted(rooted_glob(PROJECT_ROOT / 'static', 'js/instructor_dashboard/**/*.js'))
)
1310

1311 1312 1313 1314 1315
verify_student_js = [
    'js/sticky_filter.js',
    'js/query-params.js',
    'js/verify_student/models/verification_model.js',
    'js/verify_student/views/error_view.js',
1316
    'js/verify_student/views/image_input_view.js',
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329
    'js/verify_student/views/webcam_photo_view.js',
    'js/verify_student/views/step_view.js',
    'js/verify_student/views/intro_step_view.js',
    'js/verify_student/views/make_payment_step_view.js',
    'js/verify_student/views/payment_confirmation_step_view.js',
    'js/verify_student/views/face_photo_step_view.js',
    'js/verify_student/views/id_photo_step_view.js',
    'js/verify_student/views/review_photos_step_view.js',
    'js/verify_student/views/enrollment_confirmation_step_view.js',
    'js/verify_student/views/pay_and_verify_view.js',
    'js/verify_student/pay_and_verify.js',
]

1330 1331 1332 1333
reverify_js = [
    'js/verify_student/views/error_view.js',
    'js/verify_student/views/image_input_view.js',
    'js/verify_student/views/webcam_photo_view.js',
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347
    'js/verify_student/views/step_view.js',
    'js/verify_student/views/face_photo_step_view.js',
    'js/verify_student/views/id_photo_step_view.js',
    'js/verify_student/views/review_photos_step_view.js',
    'js/verify_student/views/reverify_success_step_view.js',
    'js/verify_student/models/verification_model.js',
    'js/verify_student/views/reverify_view.js',
    'js/verify_student/reverify.js',
]

incourse_reverify_js = [
    'js/verify_student/views/error_view.js',
    'js/verify_student/views/image_input_view.js',
    'js/verify_student/views/webcam_photo_view.js',
1348
    'js/verify_student/models/verification_model.js',
1349 1350 1351 1352
    'js/verify_student/views/incourse_reverify_view.js',
    'js/verify_student/incourse_reverify.js',
]

cewing committed
1353 1354
ccx_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'js/ccx/**/*.js'))

1355
certificates_web_view_js = [
1356 1357
    'common/js/vendor/jquery.js',
    'common/js/vendor/jquery-migrate.js',
1358 1359
    'js/vendor/jquery.cookie.js',
    'js/src/logger.js',
1360
    'js/utils/facebook.js',
1361
]
1362

1363
credit_web_view_js = [
1364 1365
    'common/js/vendor/jquery.js',
    'common/js/vendor/jquery-migrate.js',
1366 1367 1368 1369
    'js/vendor/jquery.cookie.js',
    'js/src/logger.js',
]

1370
PIPELINE_CSS = {
1371 1372 1373 1374 1375 1376
    'style-vendor': {
        'source_filenames': [
            'css/vendor/font-awesome.css',
            'css/vendor/jquery.qtip.min.css',
        ],
        'output_filename': 'css/lms-style-vendor.css',
1377
    },
1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389
    'style-vendor-tinymce-content': {
        'source_filenames': [
            'js/vendor/tinymce/js/tinymce/skins/studio-tmce4/content.min.css'
        ],
        'output_filename': 'css/lms-style-vendor-tinymce-content.css',
    },
    'style-vendor-tinymce-skin': {
        'source_filenames': [
            'js/vendor/tinymce/js/tinymce/skins/studio-tmce4/skin.min.css'
        ],
        'output_filename': 'css/lms-style-vendor-tinymce-skin.css',
    },
1390
    'style-main-v1': {
1391
        'source_filenames': [
1392
            'css/lms-main-v1.css',
1393
        ],
1394
        'output_filename': 'css/lms-main-v1.css',
1395
    },
1396
    'style-main-v1-rtl': {
1397
        'source_filenames': [
1398
            'css/lms-main-v1-rtl.css',
1399
        ],
1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412
        'output_filename': 'css/lms-main-v1-rtl.css',
    },
    'style-main-v2': {
        'source_filenames': [
            'css/lms-main-v2.css',
        ],
        'output_filename': 'css/lms-main-v2.css',
    },
    'style-main-v2-rtl': {
        'source_filenames': [
            'css/lms-main-v2-rtl.css',
        ],
        'output_filename': 'css/lms-main-v2-rtl.css',
1413
    },
1414
    'style-course-vendor': {
1415 1416 1417 1418
        'source_filenames': [
            'js/vendor/CodeMirror/codemirror.css',
            'css/vendor/jquery.treeview.css',
            'css/vendor/ui-lightness/jquery-ui-1.8.22.custom.css',
1419 1420 1421 1422 1423
        ],
        'output_filename': 'css/lms-style-course-vendor.css',
    },
    'style-course': {
        'source_filenames': [
1424
            'css/lms-course.css',
1425
        ],
1426
        'output_filename': 'css/lms-course.css',
1427
    },
1428 1429
    'style-course-rtl': {
        'source_filenames': [
1430
            'css/lms-course-rtl.css',
1431
        ],
1432 1433 1434 1435 1436 1437 1438
        'output_filename': 'css/lms-course-rtl.css',
    },
    'style-student-notes': {
        'source_filenames': [
            'css/vendor/edxnotes/annotator.min.css',
        ],
        'output_filename': 'css/lms-style-student-notes.css',
1439
    },
1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451
    'style-discussion-main': {
        'source_filenames': [
            'css/discussion/lms-discussion-main.css',
        ],
        'output_filename': 'css/discussion/lms-discussion-main.css',
    },
    'style-discussion-main-rtl': {
        'source_filenames': [
            'css/discussion/lms-discussion-main-rtl.css',
        ],
        'output_filename': 'css/discussion/lms-discussion-main-rtl.css',
    },
1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468
    '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/lms-style-xmodule-annotations.css',
    },
1469
    FOOTER_CSS['openedx']['ltr']: {
1470
        'source_filenames': [
1471
            'css/lms-footer.css',
1472
        ],
1473
        'output_filename': 'css/lms-footer.css',
1474
    },
1475
    FOOTER_CSS['openedx']['rtl']: {
1476
        'source_filenames': [
1477
            'css/lms-footer-rtl.css',
1478
        ],
1479 1480 1481 1482
        'output_filename': 'css/lms-footer-rtl.css'
    },
    FOOTER_CSS['edx']['ltr']: {
        'source_filenames': [
1483
            'css/lms-footer-edx.css',
1484 1485 1486 1487 1488
        ],
        'output_filename': 'css/lms-footer-edx.css'
    },
    FOOTER_CSS['edx']['rtl']: {
        'source_filenames': [
1489
            'css/lms-footer-edx-rtl.css',
1490 1491
        ],
        'output_filename': 'css/lms-footer-edx-rtl.css'
1492
    },
1493 1494
    'style-certificates': {
        'source_filenames': [
1495
            'certificates/css/main-ltr.css',
1496 1497 1498 1499 1500 1501
            'css/vendor/font-awesome.css',
        ],
        'output_filename': 'css/certificates-style.css'
    },
    'style-certificates-rtl': {
        'source_filenames': [
1502
            'certificates/css/main-rtl.css',
1503 1504 1505 1506
            'css/vendor/font-awesome.css',
        ],
        'output_filename': 'css/certificates-style-rtl.css'
    },
1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518
    'style-learner-dashboard': {
        'source_filenames': [
            'css/lms-learner-dashboard.css',
        ],
        'output_filename': 'css/lms-learner-dashboard.css',
    },
    'style-learner-dashboard-rtl': {
        'source_filenames': [
            'css/lms-learner-dashboard-rtl.css',
        ],
        'output_filename': 'css/lms-learner-dashboard-rtl.css',
    },
1519
}
1520

1521

1522 1523 1524 1525 1526 1527 1528 1529
separately_bundled_js = set(courseware_js + discussion_js + notes_js + instructor_dash_js)
common_js = sorted(set(rooted_glob(COMMON_ROOT / 'static', 'coffee/src/**/*.js')) - separately_bundled_js)
xblock_runtime_js = [
    'common/js/xblock/core.js',
    'common/js/xblock/runtime.v1.js',
    'lms/js/xblock/lms.runtime.v1.js',
]
lms_application_js = sorted(set(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/**/*.js')) - separately_bundled_js)
1530

1531
PIPELINE_JS = {
1532 1533 1534 1535 1536
    'base_application': {
        'source_filenames': base_application_js,
        'output_filename': 'js/lms-base-application.js',
    },

1537
    'application': {
1538 1539 1540 1541 1542
        'source_filenames': (
            common_js + xblock_runtime_js + base_application_js + lms_application_js +
            [
                'js/sticky_filter.js',
                'js/query-params.js',
1543
                'js/vendor/moment-with-locales.min.js',
1544 1545
            ]
        ),
1546
        'output_filename': 'js/lms-application.js',
1547
    },
1548 1549 1550 1551
    'proctoring': {
        'source_filenames': proctoring_js,
        'output_filename': 'js/lms-proctoring.js',
    },
1552
    'courseware': {
1553
        'source_filenames': courseware_js,
1554
        'output_filename': 'js/lms-courseware.js',
1555 1556 1557 1558
    },
    'base_vendor': {
        'source_filenames': base_vendor_js,
        'output_filename': 'js/lms-base-vendor.js',
1559
    },
1560 1561
    'main_vendor': {
        'source_filenames': main_vendor_js,
1562
        'output_filename': 'js/lms-main_vendor.js',
1563
    },
1564 1565 1566 1567
    'module-descriptor-js': {
        'source_filenames': rooted_glob(COMMON_ROOT / 'static/', 'xmodule/descriptors/js/*.js'),
        'output_filename': 'js/lms-module-descriptors.js',
    },
1568
    'module-js': {
1569
        'source_filenames': rooted_glob(COMMON_ROOT / 'static', 'xmodule/modules/js/*.js'),
1570
        'output_filename': 'js/lms-modules.js',
1571
    },
1572 1573
    'discussion': {
        'source_filenames': discussion_js,
1574
        'output_filename': 'js/discussion.js',
1575
    },
1576 1577 1578 1579
    'discussion_vendor': {
        'source_filenames': discussion_vendor_js,
        'output_filename': 'js/discussion_vendor.js',
    },
Arthur Barrett committed
1580 1581
    'notes': {
        'source_filenames': notes_js,
1582
        'output_filename': 'js/notes.js',
Arthur Barrett committed
1583
    },
1584 1585 1586
    'instructor_dash': {
        'source_filenames': instructor_dash_js,
        'output_filename': 'js/instructor_dash.js',
1587
    },
Will Daly committed
1588 1589 1590 1591
    'dashboard': {
        'source_filenames': dashboard_js,
        'output_filename': 'js/dashboard.js'
    },
1592 1593 1594
    'verify_student': {
        'source_filenames': verify_student_js,
        'output_filename': 'js/verify_student.js'
1595 1596 1597 1598
    },
    'reverify': {
        'source_filenames': reverify_js,
        'output_filename': 'js/reverify.js'
1599 1600 1601 1602
    },
    'incourse_reverify': {
        'source_filenames': incourse_reverify_js,
        'output_filename': 'js/incourse_reverify.js'
1603
    },
cewing committed
1604 1605 1606
    'ccx': {
        'source_filenames': ccx_js,
        'output_filename': 'js/ccx.js'
1607 1608
    },
    'footer_edx': {
1609
        'source_filenames': ['js/footer-edx.js'],
1610 1611
        'output_filename': 'js/footer-edx.js'
    },
1612 1613 1614
    'certificates_wv': {
        'source_filenames': certificates_web_view_js,
        'output_filename': 'js/certificates/web_view.js'
1615
    },
1616 1617 1618
    'credit_wv': {
        'source_filenames': credit_web_view_js,
        'output_filename': 'js/credit/web_view.js'
1619
    }
1620 1621
}

1622

1623
STATICFILES_IGNORE_PATTERNS = (
1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634
    "*.py",
    "*.pyc",

    # It would be nice if we could do, for example, "**/*.scss",
    # but these strings get passed down to the `fnmatch` module,
    # which doesn't support that. :(
    # http://docs.python.org/2/library/fnmatch.html
    "sass/*.scss",
    "sass/*/*.scss",
    "sass/*/*/*.scss",
    "sass/*/*/*/*.scss",
1635 1636 1637 1638
    "coffee/*.coffee",
    "coffee/*/*.coffee",
    "coffee/*/*/*.coffee",
    "coffee/*/*/*/*.coffee",
1639

1640 1641 1642 1643
    # Ignore tests
    "spec",
    "spec_helpers",

1644 1645
    # Symlinks used by js-test-tool
    "xmodule_js",
1646 1647
)

1648

1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660
################################# DJANGO-REQUIRE ###############################

# The baseUrl to pass to the r.js optimizer, relative to STATIC_ROOT.
REQUIRE_BASE_URL = "./"

# The name of a build profile to use for your project, relative to REQUIRE_BASE_URL.
# A sensible value would be 'app.build.js'. Leave blank to use the built-in default build profile.
# Set to False to disable running the default profile (e.g. if only using it to build Standalone
# Modules)
REQUIRE_BUILD_PROFILE = "lms/js/build.js"

# The name of the require.js script used by your project, relative to REQUIRE_BASE_URL.
Andy Armstrong committed
1661
REQUIRE_JS = "js/vendor/requirejs/require.js"
1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677

# A dictionary of standalone modules to build with almond.js.
REQUIRE_STANDALONE_MODULES = {}

# Whether to run django-require in debug mode.
REQUIRE_DEBUG = False

# A tuple of files to exclude from the compilation result of r.js.
REQUIRE_EXCLUDE = ("build.txt",)

# The execution environment in which to run r.js: auto, node or rhino.
# auto will autodetect the environment and make use of node if available and rhino if not.
# It can also be a path to a custom class that subclasses require.environments.Environment
# and defines some "args" function that returns a list with the command arguments to execute.
REQUIRE_ENVIRONMENT = "node"

1678 1679 1680 1681 1682 1683 1684 1685 1686 1687
# In production, the Django pipeline appends a file hash to JavaScript file names.
# This makes it difficult for RequireJS to load its requirements, since module names
# specified in JavaScript code do not include the hash.
# For this reason, we calculate the actual path including the hash on the server
# when rendering the page.  We then override the default paths provided to RequireJS
# so it can resolve the module name to the correct URL.
#
# If you want to load JavaScript dependencies using RequireJS
# but you don't want to include those dependencies in the JS bundle for the page,
# then you need to add the js urls in this list.
1688
REQUIRE_JS_PATH_OVERRIDES = {
1689 1690
    'js/bookmarks/views/bookmark_button': 'js/bookmarks/views/bookmark_button.js',
    'js/views/message_banner': 'js/views/message_banner.js',
1691
    'moment': 'js/vendor/moment-with-locales.min.js',
1692 1693
    'jquery.url': 'js/vendor/url.min.js',
    'js/courseware/course_home_events': 'js/courseware/course_home_events.js',
1694
    'js/courseware/accordion_events': 'js/courseware/accordion_events.js',
1695
    'js/courseware/link_clicked_events': 'js/courseware/link_clicked_events.js',
1696 1697 1698
    'js/courseware/toggle_element_visibility': 'js/courseware/toggle_element_visibility.js',
    'js/student_account/logistration_factory': 'js/student_account/logistration_factory.js',
    'js/student_profile/views/learner_profile_factory': 'js/student_profile/views/learner_profile_factory.js',
1699
    'js/courseware/courseware_factory': 'js/courseware/courseware_factory.js',
1700 1701
    'js/groups/views/cohorts_dashboard_factory': 'js/groups/views/cohorts_dashboard_factory.js',
    'draggabilly': 'js/vendor/draggabilly.js'
1702
}
1703 1704 1705 1706 1707 1708 1709 1710 1711

########################## DJANGO DEBUG TOOLBAR ###############################

# We don't enable Django Debug Toolbar universally, but whenever we do, we want
# to avoid patching settings.  Patched settings can cause circular import
# problems: http://django-debug-toolbar.readthedocs.org/en/1.0/installation.html#explicit-setup

DEBUG_TOOLBAR_PATCH_SETTINGS = False

1712 1713
################################# CELERY ######################################

1714 1715 1716 1717 1718 1719
# Celery's task autodiscovery won't find tasks nested in a tasks package.
# Tasks are only registered when the module they are defined in is imported.
CELERY_IMPORTS = (
    'openedx.core.djangoapps.programs.tasks.v1.tasks',
)

1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748
# Message configuration

CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'

CELERY_MESSAGE_COMPRESSION = 'gzip'

# Results configuration

CELERY_IGNORE_RESULT = False
CELERY_STORE_ERRORS_EVEN_IF_IGNORED = True

# Events configuration

CELERY_TRACK_STARTED = True

CELERY_SEND_EVENTS = True
CELERY_SEND_TASK_SENT_EVENT = True

# Exchange configuration

CELERY_DEFAULT_EXCHANGE = 'edx.core'
CELERY_DEFAULT_EXCHANGE_TYPE = 'direct'

# Queues configuration

HIGH_PRIORITY_QUEUE = 'edx.core.high'
DEFAULT_PRIORITY_QUEUE = 'edx.core.default'
LOW_PRIORITY_QUEUE = 'edx.core.low'
1749
HIGH_MEM_QUEUE = 'edx.core.high_mem'
1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760

CELERY_QUEUE_HA_POLICY = 'all'

CELERY_CREATE_MISSING_QUEUES = True

CELERY_DEFAULT_QUEUE = DEFAULT_PRIORITY_QUEUE
CELERY_DEFAULT_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE

CELERY_QUEUES = {
    HIGH_PRIORITY_QUEUE: {},
    LOW_PRIORITY_QUEUE: {},
1761 1762
    DEFAULT_PRIORITY_QUEUE: {},
    HIGH_MEM_QUEUE: {},
1763 1764
}

1765 1766 1767
# let logging work as configured:
CELERYD_HIJACK_ROOT_LOGGER = False

1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784
################################ Block Structures ###################################

BLOCK_STRUCTURES_SETTINGS = dict(
    # Delay, in seconds, after a new edit of a course is published
    # before updating the block structures cache.  This is needed
    # for a better chance at getting the latest changes when there
    # are secondary reads in sharded mongoDB clusters. See TNL-5041
    # for more info.
    BLOCK_STRUCTURES_COURSE_PUBLISH_TASK_DELAY=30,

    # Delay, in seconds, between retry attempts if a task fails.
    BLOCK_STRUCTURES_TASK_DEFAULT_RETRY_DELAY=30,

    # Maximum number of retries per task.
    BLOCK_STRUCTURES_TASK_MAX_RETRIES=5,
)

1785 1786
################################ Bulk Email ###################################

1787 1788
# Suffix used to construct 'from' email address for bulk emails.
# A course-specific identifier is prepended.
1789
BULK_EMAIL_DEFAULT_FROM_EMAIL = 'no-reply@example.com'
1790 1791 1792

# Parameters for breaking down course enrollment into subtasks.
BULK_EMAIL_EMAILS_PER_TASK = 100
1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805

# Initial delay used for retrying tasks.  Additional retries use
# longer delays.  Value is in seconds.
BULK_EMAIL_DEFAULT_RETRY_DELAY = 30

# Maximum number of retries per task for errors that are not related
# to throttling.
BULK_EMAIL_MAX_RETRIES = 5

# Maximum number of retries per task for errors that are related to
# throttling.  If this is not set, then there is no cap on such retries.
BULK_EMAIL_INFINITE_RETRY_CAP = 1000

1806 1807 1808
# We want Bulk Email running on the high-priority queue, so we define the
# routing key that points to it.  At the moment, the name is the same.
BULK_EMAIL_ROUTING_KEY = HIGH_PRIORITY_QUEUE
1809

1810 1811
# We also define a queue for smaller jobs so that large courses don't block
# smaller emails (see BULK_EMAIL_JOB_SIZE_THRESHOLD setting)
1812
BULK_EMAIL_ROUTING_KEY_SMALL_JOBS = LOW_PRIORITY_QUEUE
1813 1814 1815 1816 1817 1818

# For emails with fewer than these number of recipients, send them through
# a different queue to avoid large courses blocking emails that are meant to be
# sent to self and staff
BULK_EMAIL_JOB_SIZE_THRESHOLD = 100

1819 1820 1821
# Flag to indicate if individual email addresses should be logged as they are sent
# a bulk email message.
BULK_EMAIL_LOG_SENT_EMAILS = False
1822

1823 1824 1825 1826 1827 1828
# Delay in seconds to sleep between individual mail messages being sent,
# when a bulk email task is retried for rate-related reasons.  Choose this
# value depending on the number of workers that might be sending email in
# parallel, and what the SES rate is.
BULK_EMAIL_RETRY_DELAY_BETWEEN_SENDS = 0.02

1829 1830 1831
############################# Email Opt In ####################################

# Minimum age for organization-wide email opt in
1832
EMAIL_OPTIN_MINIMUM_AGE = PARENTAL_CONSENT_AGE_LIMIT
1833

1834 1835
############################## Video ##########################################

1836 1837
YOUTUBE = {
    # YouTube JavaScript API
1838
    'API': 'https://www.youtube.com/iframe_api',
1839

1840 1841
    # URL to get YouTube metadata
    'METADATA_URL': 'https://www.googleapis.com/youtube/v3/videos/',
1842 1843 1844 1845 1846 1847 1848 1849 1850 1851

    # Current youtube api for requesting transcripts.
    # For example: http://video.google.com/timedtext?lang=en&v=j_jEn79vS3g.
    'TEXT_API': {
        'url': 'video.google.com/timedtext',
        'params': {
            'lang': 'en',
            'v': 'set_youtube_id_of_11_symbols_here',
        },
    },
Alexander Kryklia committed
1852 1853

    'IMAGE_API': 'http://img.youtube.com/vi/{youtube_id}/0.jpg',  # /maxresdefault.jpg for 1920*1080
1854
}
1855
YOUTUBE_API_KEY = None
1856

1857
################################### APPS ######################################
1858 1859 1860 1861 1862 1863
INSTALLED_APPS = (
    # Standard ones that are always installed...
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.humanize',
    'django.contrib.messages',
1864
    'django.contrib.redirects',
1865 1866
    'django.contrib.sessions',
    'django.contrib.sites',
1867
    'django.contrib.staticfiles',
1868
    'djcelery',
1869

1870 1871 1872
    # Common views
    'openedx.core.djangoapps.common_views',

1873 1874 1875
    # History tables
    'simple_history',

1876 1877 1878
    # Database-backed configuration
    'config_models',

1879 1880 1881
    # Monitor the status of services
    'service_status',

1882 1883 1884
    # Display status message to students
    'status',

1885
    # For asset pipelining
David Baumgold committed
1886
    'edxmako',
1887
    'pipeline',
1888
    'static_replace',
1889

1890 1891 1892
    # For content serving
    'contentserver',

David Baumgold committed
1893 1894 1895
    # Theming
    'openedx.core.djangoapps.theming',

1896 1897 1898
    # Site configuration for theming and behavioral modification
    'openedx.core.djangoapps.site_configuration',

1899 1900 1901
    # Our courseware
    'courseware',
    'student',
1902

1903 1904 1905
    'static_template_view',
    'staticbook',
    'track',
1906
    'eventtracking.django.apps.EventTrackingConfig',
1907
    'util',
1908
    'certificates',
Carson Gee committed
1909
    'dashboard',
1910
    'instructor',
1911
    'instructor_task',
1912
    'openedx.core.djangoapps.course_groups',
1913
    'bulk_email',
1914
    'branding',
1915
    'lms.djangoapps.grades.apps.GradesConfig',
1916

1917 1918 1919
    # Student support tools
    'support',

1920 1921 1922 1923
    # External auth (OpenID, shib)
    'external_auth',
    'django_openid_auth',

1924
    # django-oauth2-provider (deprecated)
1925 1926
    'provider',
    'provider.oauth2',
1927
    'edx_oauth2_provider',
1928 1929

    # django-oauth-toolkit
1930
    'oauth2_provider',
1931
    'lms.djangoapps.oauth_dispatch.apps.OAuthDispatchAppConfig',
1932

1933 1934
    'third_party_auth',

1935 1936 1937 1938 1939 1940
    # We don't use this directly (since we use OAuth2), but we need to install it anyway.
    # When a user is deleted, Django queries all tables with a FK to the auth_user table,
    # and since django-rest-framework-oauth imports this, it will try to access tables
    # defined by oauth_provider.  If those tables don't exist, an error can occur.
    'oauth_provider',

1941
    'auth_exchange',
1942

1943
    # For the wiki
1944
    'wiki',  # The new django-wiki from benjaoming
1945
    'django_notify',
1946
    'course_wiki',  # Our customizations
1947 1948
    'mptt',
    'sekizai',
1949
    #'wiki.plugins.attachments',
1950
    'wiki.plugins.links',
1951 1952 1953 1954
    # Notifications were enabled, but only 11 people used it in three years. It
    # got tangled up during the Django 1.8 migration, so we are disabling it.
    # See TNL-3783 for details.
    #'wiki.plugins.notifications',
1955
    'course_wiki.plugins.markdownedx',
1956

1957
    # For testing
1958
    'django.contrib.admin',  # only used in DEBUG mode
1959
    'django_nose',
1960
    'debug',
1961

1962
    # Discussion forums
1963
    'django_comment_client',
1964
    'django_comment_common',
Greg Price committed
1965
    'discussion_api',
1966
    'lms.djangoapps.discussion',
1967

1968 1969
    # Notes
    'notes',
1970 1971
    'edxnotes',

1972 1973 1974
    # Splash screen
    'splash',

1975 1976 1977
    # Monitoring
    'datadog',

1978 1979
    # User API
    'rest_framework',
1980
    'openedx.core.djangoapps.user_api',
1981

1982
    # Shopping cart
1983 1984
    'shoppingcart',

1985 1986
    # Notification preferences setting
    'notification_prefs',
1987

1988 1989
    'notifier_api',

1990
    # Different Course Modes
1991
    'course_modes',
1992

1993 1994 1995
    # Enrollment API
    'enrollment',

1996
    # Student Identity Verification
1997
    'lms.djangoapps.verify_student',
1998 1999 2000

    # Dark-launching languages
    'dark_lang',
2001 2002

    # Microsite configuration
2003
    'microsite_configuration',
2004

2005 2006 2007
    # RSS Proxy
    'rss_proxy',

2008 2009
    # Student Identity Reverification
    'reverification',
2010 2011

    'embargo',
2012 2013 2014

    # Monitoring functionality
    'monitoring',
2015 2016

    # Course action state
Chris Rossi committed
2017 2018 2019 2020
    'course_action_state',

    # Additional problem types
    'edx_jsme',    # Molecular Structure
2021 2022

    # Country list
2023 2024 2025 2026
    'django_countries',

    # edX Mobile API
    'mobile_api',
2027
    'social.apps.django_app.default',
2028 2029 2030

    # Surveys
    'survey',
2031 2032

    'lms.djangoapps.lms_xblock',
2033

2034
    # Course data caching
2035
    'openedx.core.djangoapps.content.course_overviews',
2036 2037
    'openedx.core.djangoapps.content.course_structures.apps.CourseStructuresConfig',
    'openedx.core.djangoapps.content.block_structure.apps.BlockStructureConfig',
2038 2039 2040
    'lms.djangoapps.course_blocks',

    # Old course structure API
2041
    'course_structure_api',
Will Daly committed
2042

2043 2044 2045
    # Mailchimp Syncing
    'mailing',

Will Daly committed
2046 2047
    # CORS and cross-domain CSRF
    'corsheaders',
2048 2049 2050
    'cors_csrf',

    'commerce',
2051 2052 2053

    # Credit courses
    'openedx.core.djangoapps.credit',
Diana Huang committed
2054 2055

    # Course teams
2056
    'lms.djangoapps.teams',
2057

2058
    'xblock_django',
2059

muzaffaryousaf committed
2060
    # Bookmarks
2061
    'openedx.core.djangoapps.bookmarks',
muzaffaryousaf committed
2062

2063 2064
    # programs support
    'openedx.core.djangoapps.programs',
2065

2066 2067 2068
    # Catalog integration
    'openedx.core.djangoapps.catalog',

2069 2070
    # Self-paced course configuration
    'openedx.core.djangoapps.self_paced',
2071 2072

    'sorl.thumbnail',
2073 2074 2075

    # Credentials support
    'openedx.core.djangoapps.credentials',
2076 2077 2078 2079 2080 2081

    # edx-milestones service
    'milestones',

    # Gating of course content
    'gating.apps.GatingConfig',
2082 2083 2084

    # Static i18n support
    'statici18n',
erm0l0v committed
2085 2086 2087

    # Review widgets
    'openedx.core.djangoapps.coursetalk',
2088 2089 2090

    # API access administration
    'openedx.core.djangoapps.api_admin',
2091

2092 2093
    # Verified Track Content Cohorting
    'verified_track_content',
2094 2095 2096

    # Learner's dashboard
    'learner_dashboard',
2097 2098 2099

    # Needed whether or not enabled, due to migrations
    'badges',
2100 2101 2102

    # Enables default site and redirects
    'django_sites_extensions',
2103 2104 2105

    # Email marketing integration
    'email_marketing',
2106 2107 2108

    # additional release utilities to ease automation
    'release_util',
2109
)
2110

2111 2112 2113 2114 2115
# Migrations which are not in the standard module "migrations"
MIGRATION_MODULES = {
    'social.apps.django_app.default': 'social.apps.django_app.default.south_migrations'
}

Will Daly committed
2116 2117 2118 2119
######################### CSRF #########################################

# Forwards-compatibility with Django 1.7
CSRF_COOKIE_AGE = 60 * 60 * 24 * 7 * 52
e0d committed
2120
# It is highly recommended that you override this in any environment accessed by
2121 2122
# end users
CSRF_COOKIE_SECURE = False
Will Daly committed
2123

2124 2125 2126 2127 2128
######################### Django Rest Framework ########################

REST_FRAMEWORK = {
    'DEFAULT_PAGINATION_CLASS': 'openedx.core.lib.api.paginators.DefaultPagination',
    'PAGE_SIZE': 10,
2129
    'URL_FORMAT_OVERRIDE': None,
2130 2131 2132
}


2133
######################### MARKETING SITE ###############################
Will Daly committed
2134 2135 2136 2137
EDXMKTG_LOGGED_IN_COOKIE_NAME = 'edxloggedin'
EDXMKTG_USER_INFO_COOKIE_NAME = 'edx-user-info'
EDXMKTG_USER_INFO_COOKIE_VERSION = 1

2138
MKTG_URLS = {}
2139
MKTG_URL_LINK_MAP = {
2140
    'ABOUT': 'about',
2141
    'CONTACT': 'contact',
2142
    'FAQ': 'help',
2143 2144
    'COURSES': 'courses',
    'ROOT': 'root',
2145
    'TOS': 'tos',
2146
    'HONOR': 'honor',  # If your site does not have an honor code, simply delete this line.
2147
    'PRIVACY': 'privacy',
2148
    'PRESS': 'press',
2149
    'BLOG': 'blog',
2150
    'DONATE': 'donate',
2151
    'SITEMAP.XML': 'sitemap_xml',
2152 2153

    # Verified Certificates
2154
    'WHAT_IS_VERIFIED_CERT': 'verified-certificate',
2155
}
2156

2157 2158
STATIC_TEMPLATE_VIEW_DEFAULT_FILE_EXTENSION = 'html'

Peter Fogg committed
2159 2160
SUPPORT_SITE_LINK = ''

2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174
############################# SOCIAL MEDIA SHARING #############################
# Social Media Sharing on Student Dashboard
SOCIAL_SHARING_SETTINGS = {
    # Note: Ensure 'CUSTOM_COURSE_URLS' has a matching value in cms/envs/common.py
    'CUSTOM_COURSE_URLS': False,
    'DASHBOARD_FACEBOOK': False,
    'CERTIFICATE_FACEBOOK': False,
    'CERTIFICATE_FACEBOOK_TEXT': None,
    'CERTIFICATE_TWITTER': False,
    'CERTIFICATE_TWITTER_TEXT': None,
    'DASHBOARD_TWITTER': False,
    'DASHBOARD_TWITTER_TEXT': None
}

2175 2176 2177
################# Social Media Footer Links #######################
# The names list controls the order of social media
# links in the footer.
2178 2179 2180 2181 2182 2183 2184 2185
SOCIAL_MEDIA_FOOTER_NAMES = [
    "facebook",
    "twitter",
    "youtube",
    "linkedin",
    "google_plus",
    "reddit",
]
2186

Ahsan Ulhaq committed
2187 2188
# JWT Settings
JWT_AUTH = {
2189 2190
    # TODO Set JWT_SECRET_KEY to a secure value. By default, SECRET_KEY will be used.
    # 'JWT_SECRET_KEY': '',
Ahsan Ulhaq committed
2191 2192
    'JWT_ALGORITHM': 'HS256',
    'JWT_VERIFY_EXPIRATION': True,
2193 2194
    # TODO Set JWT_ISSUER and JWT_AUDIENCE to values specific to your service/organization.
    'JWT_ISSUER': 'change-me',
Ahsan Ulhaq committed
2195
    'JWT_AUDIENCE': None,
2196
    'JWT_PAYLOAD_GET_USERNAME_HANDLER': lambda d: d.get('username'),
Ahsan Ulhaq committed
2197
    'JWT_LEEWAY': 1,
2198
    'JWT_DECODE_HANDLER': 'edx_rest_framework_extensions.utils.jwt_decode_handler',
2199 2200
    # Number of seconds before JWT tokens expire
    'JWT_EXPIRATION': 30,
Ahsan Ulhaq committed
2201 2202
}

2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213
# The footer URLs dictionary maps social footer names
# to URLs defined in configuration.
SOCIAL_MEDIA_FOOTER_URLS = {}

# The display dictionary defines the title
# and icon class for each social media link.
SOCIAL_MEDIA_FOOTER_DISPLAY = {
    "facebook": {
        # Translators: This is the website name of www.facebook.com.  Please
        # translate this the way that Facebook advertises in your language.
        "title": _("Facebook"),
2214 2215
        "icon": "fa-facebook-square",
        "action": _("Like {platform_name} on Facebook")
2216 2217 2218 2219 2220
    },
    "twitter": {
        # Translators: This is the website name of www.twitter.com.  Please
        # translate this the way that Twitter advertises in your language.
        "title": _("Twitter"),
2221 2222
        "icon": "fa-twitter",
        "action": _("Follow {platform_name} on Twitter")
2223 2224 2225 2226 2227
    },
    "linkedin": {
        # Translators: This is the website name of www.linkedin.com.  Please
        # translate this the way that LinkedIn advertises in your language.
        "title": _("LinkedIn"),
2228 2229
        "icon": "fa-linkedin-square",
        "action": _("Follow {platform_name} on LinkedIn")
2230 2231 2232 2233 2234
    },
    "google_plus": {
        # Translators: This is the website name of plus.google.com.  Please
        # translate this the way that Google+ advertises in your language.
        "title": _("Google+"),
2235 2236
        "icon": "fa-google-plus-square",
        "action": _("Follow {platform_name} on Google+")
2237 2238 2239 2240 2241
    },
    "tumblr": {
        # Translators: This is the website name of www.tumblr.com.  Please
        # translate this the way that Tumblr advertises in your language.
        "title": _("Tumblr"),
2242
        "icon": "fa-tumblr"
2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253
    },
    "meetup": {
        # Translators: This is the website name of www.meetup.com.  Please
        # translate this the way that MeetUp advertises in your language.
        "title": _("Meetup"),
        "icon": "fa-calendar"
    },
    "reddit": {
        # Translators: This is the website name of www.reddit.com.  Please
        # translate this the way that Reddit advertises in your language.
        "title": _("Reddit"),
2254 2255
        "icon": "fa-reddit",
        "action": _("Subscribe to the {platform_name} subreddit"),
2256
    },
2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268
    "vk": {
        # Translators: This is the website name of https://vk.com.  Please
        # translate this the way that VK advertises in your language.
        "title": _("VK"),
        "icon": "fa-vk"
    },
    "weibo": {
        # Translators: This is the website name of http://www.weibo.com.  Please
        # translate this the way that Weibo advertises in your language.
        "title": _("Weibo"),
        "icon": "fa-weibo"
    },
2269 2270 2271 2272
    "youtube": {
        # Translators: This is the website name of www.youtube.com.  Please
        # translate this the way that YouTube advertises in your language.
        "title": _("Youtube"),
2273 2274
        "icon": "fa-youtube",
        "action": _("Subscribe to the {platform_name} YouTube channel")
2275 2276 2277
    }
}

2278 2279 2280 2281 2282 2283 2284
################# Mobile URLS ##########################

# These are URLs to the app store for mobile.
MOBILE_STORE_URLS = {
    'apple': '#',
    'google': '#'
}
2285

2286 2287
################# Student Verification #################
VERIFY_STUDENT = {
2288
    "DAYS_GOOD_FOR": 365,  # How many days is a verficiation good for?
2289
}
2290

2291 2292 2293 2294 2295
### This enables the Metrics tab for the Instructor dashboard ###########
FEATURES['CLASS_DASHBOARD'] = False
if FEATURES.get('CLASS_DASHBOARD'):
    INSTALLED_APPS += ('class_dashboard',)

2296
################ Enable credit eligibility feature ####################
2297
ENABLE_CREDIT_ELIGIBILITY = True
2298 2299
FEATURES['ENABLE_CREDIT_ELIGIBILITY'] = ENABLE_CREDIT_ELIGIBILITY

2300 2301
######################## CAS authentication ###########################

2302
if FEATURES.get('AUTH_USE_CAS'):
2303 2304 2305 2306
    CAS_SERVER_URL = 'https://provide_your_cas_url_here'
    AUTHENTICATION_BACKENDS = (
        'django.contrib.auth.backends.ModelBackend',
        'django_cas.backends.CASBackend',
2307
    )
2308 2309
    INSTALLED_APPS += ('django_cas',)
    MIDDLEWARE_CLASSES += ('django_cas.middleware.CASMiddleware',)
2310

2311
############# Cross-domain requests #################
2312 2313 2314 2315

if FEATURES.get('ENABLE_CORS_HEADERS'):
    CORS_ALLOW_CREDENTIALS = True
    CORS_ORIGIN_WHITELIST = ()
2316
    CORS_ORIGIN_ALLOW_ALL = False
2317

2318 2319 2320 2321 2322
# Default cache expiration for the cross-domain proxy HTML page.
# This is a static page that can be iframed into an external page
# to simulate cross-domain requests.
XDOMAIN_PROXY_CACHE_TIMEOUT = 60 * 15

2323 2324
###################### Registration ##################################

2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336
# For each of the fields, give one of the following values:
# - 'required': to display the field, and make it mandatory
# - 'optional': to display the field, and make it non-mandatory
# - 'hidden': to not display the field

REGISTRATION_EXTRA_FIELDS = {
    'level_of_education': 'optional',
    'gender': 'optional',
    'year_of_birth': 'optional',
    'mailing_address': 'optional',
    'goals': 'optional',
    'honor_code': 'required',
2337
    'terms_of_service': 'hidden',
2338 2339 2340
    'city': 'hidden',
    'country': 'hidden',
}
2341

2342 2343 2344 2345
# Optional setting to restrict registration / account creation to only emails
# that match a regex in this list. Set to None to allow any email (default).
REGISTRATION_EMAIL_PATTERNS_ALLOWED = None

2346 2347 2348 2349
########################## CERTIFICATE NAME ########################
CERT_NAME_SHORT = "Certificate"
CERT_NAME_LONG = "Certificate of Achievement"

2350 2351 2352 2353
#################### OpenBadges Settings #######################

BADGING_BACKEND = 'badges.backends.badgr.BadgrBackend'

2354 2355 2356 2357 2358
# Be sure to set up images for course modes using the BadgeImageConfiguration model in the certificates app.
BADGR_API_TOKEN = None
# Do not add the trailing slash here.
BADGR_BASE_URL = "http://localhost:8005"
BADGR_ISSUER_SLUG = "example-issuer"
2359 2360
# Number of seconds to wait on the badging server when contacting it before giving up.
BADGR_TIMEOUT = 10
2361

2362
###################### Grade Downloads ######################
2363 2364
# These keys are used for all of our asynchronous downloadable files, including
# the ones that contain information other than grades.
2365 2366 2367
GRADES_DOWNLOAD_ROUTING_KEY = HIGH_MEM_QUEUE

GRADES_DOWNLOAD = {
2368 2369 2370
    'STORAGE_TYPE': 'localfs',
    'BUCKET': 'edx-grades',
    'ROOT_PATH': '/tmp/edx-s3/grades',
2371
}
2372

2373 2374 2375 2376 2377 2378
FINANCIAL_REPORTS = {
    'STORAGE_TYPE': 'localfs',
    'BUCKET': 'edx-financial-reports',
    'ROOT_PATH': '/tmp/edx-s3/financial_reports',
}

2379
#### PASSWORD POLICY SETTINGS #####
2380
PASSWORD_MIN_LENGTH = 8
2381
PASSWORD_MAX_LENGTH = None
2382
PASSWORD_COMPLEXITY = {"UPPER": 1, "LOWER": 1, "DIGITS": 1}
2383 2384 2385
PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD = None
PASSWORD_DICTIONARY = []

2386 2387 2388 2389 2390
############################ ORA 2 ############################################

# By default, don't use a file prefix
ORA2_FILE_PREFIX = None

Stephen Sanchez committed
2391 2392 2393
# Default File Upload Storage bucket and prefix. Used by the FileUpload Service.
FILE_UPLOAD_STORAGE_BUCKET_NAME = 'edxuploads'
FILE_UPLOAD_STORAGE_PREFIX = 'submissions_attachments'
2394

2395 2396 2397
##### ACCOUNT LOCKOUT DEFAULT PARAMETERS #####
MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED = 5
MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = 15 * 60
2398 2399 2400 2401


##### LMS DEADLINE DISPLAY TIME_ZONE #######
TIME_ZONE_DISPLAYED_FOR_DEADLINES = 'UTC'
2402 2403 2404 2405


# Source:
# http://loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt according to http://en.wikipedia.org/wiki/ISO_639-1
2406 2407
# Note that this is used as the set of choices to the `code` field of the
# `LanguageProficiency` model.
2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433
ALL_LANGUAGES = (
    [u"aa", u"Afar"],
    [u"ab", u"Abkhazian"],
    [u"af", u"Afrikaans"],
    [u"ak", u"Akan"],
    [u"sq", u"Albanian"],
    [u"am", u"Amharic"],
    [u"ar", u"Arabic"],
    [u"an", u"Aragonese"],
    [u"hy", u"Armenian"],
    [u"as", u"Assamese"],
    [u"av", u"Avaric"],
    [u"ae", u"Avestan"],
    [u"ay", u"Aymara"],
    [u"az", u"Azerbaijani"],
    [u"ba", u"Bashkir"],
    [u"bm", u"Bambara"],
    [u"eu", u"Basque"],
    [u"be", u"Belarusian"],
    [u"bn", u"Bengali"],
    [u"bh", u"Bihari languages"],
    [u"bi", u"Bislama"],
    [u"bs", u"Bosnian"],
    [u"br", u"Breton"],
    [u"bg", u"Bulgarian"],
    [u"my", u"Burmese"],
2434
    [u"ca", u"Catalan"],
2435 2436 2437
    [u"ch", u"Chamorro"],
    [u"ce", u"Chechen"],
    [u"zh", u"Chinese"],
2438 2439
    [u"zh_HANS", u"Simplified Chinese"],
    [u"zh_HANT", u"Traditional Chinese"],
2440
    [u"cu", u"Church Slavic"],
2441 2442 2443 2444 2445 2446
    [u"cv", u"Chuvash"],
    [u"kw", u"Cornish"],
    [u"co", u"Corsican"],
    [u"cr", u"Cree"],
    [u"cs", u"Czech"],
    [u"da", u"Danish"],
2447 2448
    [u"dv", u"Divehi"],
    [u"nl", u"Dutch"],
2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461
    [u"dz", u"Dzongkha"],
    [u"en", u"English"],
    [u"eo", u"Esperanto"],
    [u"et", u"Estonian"],
    [u"ee", u"Ewe"],
    [u"fo", u"Faroese"],
    [u"fj", u"Fijian"],
    [u"fi", u"Finnish"],
    [u"fr", u"French"],
    [u"fy", u"Western Frisian"],
    [u"ff", u"Fulah"],
    [u"ka", u"Georgian"],
    [u"de", u"German"],
2462
    [u"gd", u"Gaelic"],
2463 2464 2465
    [u"ga", u"Irish"],
    [u"gl", u"Galician"],
    [u"gv", u"Manx"],
2466
    [u"el", u"Greek"],
2467 2468
    [u"gn", u"Guarani"],
    [u"gu", u"Gujarati"],
2469
    [u"ht", u"Haitian"],
2470 2471 2472 2473 2474 2475 2476 2477 2478 2479
    [u"ha", u"Hausa"],
    [u"he", u"Hebrew"],
    [u"hz", u"Herero"],
    [u"hi", u"Hindi"],
    [u"ho", u"Hiri Motu"],
    [u"hr", u"Croatian"],
    [u"hu", u"Hungarian"],
    [u"ig", u"Igbo"],
    [u"is", u"Icelandic"],
    [u"io", u"Ido"],
2480
    [u"ii", u"Sichuan Yi"],
2481
    [u"iu", u"Inuktitut"],
2482 2483
    [u"ie", u"Interlingue"],
    [u"ia", u"Interlingua"],
2484 2485 2486 2487 2488
    [u"id", u"Indonesian"],
    [u"ik", u"Inupiaq"],
    [u"it", u"Italian"],
    [u"jv", u"Javanese"],
    [u"ja", u"Japanese"],
2489
    [u"kl", u"Kalaallisut"],
2490 2491 2492 2493 2494
    [u"kn", u"Kannada"],
    [u"ks", u"Kashmiri"],
    [u"kr", u"Kanuri"],
    [u"kk", u"Kazakh"],
    [u"km", u"Central Khmer"],
2495
    [u"ki", u"Kikuyu"],
2496
    [u"rw", u"Kinyarwanda"],
2497
    [u"ky", u"Kirghiz"],
2498 2499 2500
    [u"kv", u"Komi"],
    [u"kg", u"Kongo"],
    [u"ko", u"Korean"],
2501
    [u"kj", u"Kuanyama"],
2502 2503 2504 2505
    [u"ku", u"Kurdish"],
    [u"lo", u"Lao"],
    [u"la", u"Latin"],
    [u"lv", u"Latvian"],
2506
    [u"li", u"Limburgan"],
2507 2508
    [u"ln", u"Lingala"],
    [u"lt", u"Lithuanian"],
2509
    [u"lb", u"Luxembourgish"],
2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521
    [u"lu", u"Luba-Katanga"],
    [u"lg", u"Ganda"],
    [u"mk", u"Macedonian"],
    [u"mh", u"Marshallese"],
    [u"ml", u"Malayalam"],
    [u"mi", u"Maori"],
    [u"mr", u"Marathi"],
    [u"ms", u"Malay"],
    [u"mg", u"Malagasy"],
    [u"mt", u"Maltese"],
    [u"mn", u"Mongolian"],
    [u"na", u"Nauru"],
2522 2523 2524
    [u"nv", u"Navajo"],
    [u"nr", u"Ndebele, South"],
    [u"nd", u"Ndebele, North"],
2525 2526
    [u"ng", u"Ndonga"],
    [u"ne", u"Nepali"],
2527 2528
    [u"nn", u"Norwegian Nynorsk"],
    [u"nb", u"Bokmål, Norwegian"],
2529
    [u"no", u"Norwegian"],
2530 2531
    [u"ny", u"Chichewa"],
    [u"oc", u"Occitan"],
2532 2533 2534
    [u"oj", u"Ojibwa"],
    [u"or", u"Oriya"],
    [u"om", u"Oromo"],
2535 2536
    [u"os", u"Ossetian"],
    [u"pa", u"Panjabi"],
2537 2538 2539 2540
    [u"fa", u"Persian"],
    [u"pi", u"Pali"],
    [u"pl", u"Polish"],
    [u"pt", u"Portuguese"],
2541
    [u"ps", u"Pushto"],
2542 2543
    [u"qu", u"Quechua"],
    [u"rm", u"Romansh"],
2544
    [u"ro", u"Romanian"],
2545 2546 2547 2548
    [u"rn", u"Rundi"],
    [u"ru", u"Russian"],
    [u"sg", u"Sango"],
    [u"sa", u"Sanskrit"],
2549
    [u"si", u"Sinhala"],
2550 2551 2552 2553 2554 2555 2556 2557
    [u"sk", u"Slovak"],
    [u"sl", u"Slovenian"],
    [u"se", u"Northern Sami"],
    [u"sm", u"Samoan"],
    [u"sn", u"Shona"],
    [u"sd", u"Sindhi"],
    [u"so", u"Somali"],
    [u"st", u"Sotho, Southern"],
2558
    [u"es", u"Spanish"],
2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579
    [u"sc", u"Sardinian"],
    [u"sr", u"Serbian"],
    [u"ss", u"Swati"],
    [u"su", u"Sundanese"],
    [u"sw", u"Swahili"],
    [u"sv", u"Swedish"],
    [u"ty", u"Tahitian"],
    [u"ta", u"Tamil"],
    [u"tt", u"Tatar"],
    [u"te", u"Telugu"],
    [u"tg", u"Tajik"],
    [u"tl", u"Tagalog"],
    [u"th", u"Thai"],
    [u"bo", u"Tibetan"],
    [u"ti", u"Tigrinya"],
    [u"to", u"Tonga (Tonga Islands)"],
    [u"tn", u"Tswana"],
    [u"ts", u"Tsonga"],
    [u"tk", u"Turkmen"],
    [u"tr", u"Turkish"],
    [u"tw", u"Twi"],
2580
    [u"ug", u"Uighur"],
2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592
    [u"uk", u"Ukrainian"],
    [u"ur", u"Urdu"],
    [u"uz", u"Uzbek"],
    [u"ve", u"Venda"],
    [u"vi", u"Vietnamese"],
    [u"vo", u"Volapük"],
    [u"cy", u"Welsh"],
    [u"wa", u"Walloon"],
    [u"wo", u"Wolof"],
    [u"xh", u"Xhosa"],
    [u"yi", u"Yiddish"],
    [u"yo", u"Yoruba"],
2593
    [u"za", u"Zhuang"],
2594 2595
    [u"zu", u"Zulu"]
)
2596 2597


2598 2599 2600
### Apps only installed in some instances
OPTIONAL_APPS = (
    'mentoring',
2601
    'problem_builder',
2602
    'edx_sga',
Will Daly committed
2603 2604 2605 2606 2607

    # edx-ora2
    'submissions',
    'openassessment',
    'openassessment.assessment',
2608
    'openassessment.fileupload',
Will Daly committed
2609
    'openassessment.workflow',
2610 2611 2612
    'openassessment.xblock',

    # edxval
2613
    'edxval',
2614

2615 2616
    # edX Proctoring
    'edx_proctoring',
2617 2618 2619

    # Organizations App (http://github.com/edx/edx-organizations)
    'organizations',
2620
)
2621

2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633
for app_name in OPTIONAL_APPS:
    # First attempt to only find the module rather than actually importing it,
    # to avoid circular references - only try to import if it can't be found
    # by find_module, which doesn't work with import hooks
    try:
        imp.find_module(app_name)
    except ImportError:
        try:
            __import__(app_name)
        except ImportError:
            continue
    INSTALLED_APPS += (app_name,)
2634

2635 2636 2637
### ADVANCED_SECURITY_CONFIG
# Empty by default
ADVANCED_SECURITY_CONFIG = {}
2638 2639 2640 2641

### External auth usage -- prefixes for ENROLLMENT_DOMAIN
SHIBBOLETH_DOMAIN_PREFIX = 'shib:'
OPENID_DOMAIN_PREFIX = 'openid:'
2642

2643
### Analytics Data API + Dashboard (Insights) settings
2644 2645
ANALYTICS_DATA_URL = ""
ANALYTICS_DATA_TOKEN = ""
2646
ANALYTICS_DASHBOARD_URL = ""
2647
ANALYTICS_DASHBOARD_NAME = PLATFORM_NAME + " Insights"
2648

2649 2650 2651
# REGISTRATION CODES DISPLAY INFORMATION SUBTITUTIONS IN THE INVOICE ATTACHMENT
INVOICE_CORP_ADDRESS = "Please place your corporate address\nin this configuration"
INVOICE_PAYMENT_INSTRUCTIONS = "This is where you can\nput directions on how people\nbuying registration codes"
2652 2653 2654 2655

# Country code overrides
# Used by django-countries
COUNTRIES_OVERRIDE = {
2656 2657
    # Taiwan is specifically not translated to avoid it being translated as "Taiwan (Province of China)"
    "TW": "Taiwan",
2658
    'XK': _('Kosovo'),
2659
}
2660 2661 2662 2663 2664 2665 2666 2667

# which access.py permission name to check in order to determine if a course is visible in
# the course catalog. We default this to the legacy permission 'see_exists'.
COURSE_CATALOG_VISIBILITY_PERMISSION = 'see_exists'

# which access.py permission name to check in order to determine if a course about page is
# visible. We default this to the legacy permission 'see_exists'.
COURSE_ABOUT_VISIBILITY_PERMISSION = 'see_exists'
2668

2669

2670 2671 2672
# Enrollment API Cache Timeout
ENROLLMENT_COURSE_DETAILS_CACHE_TIMEOUT = 60

2673 2674

OAUTH_ID_TOKEN_EXPIRATION = 60 * 60
2675

2676 2677 2678
# These tabs are currently disabled
NOTES_DISABLED_TABS = ['course_structure', 'tags']

2679 2680 2681 2682 2683 2684 2685 2686 2687 2688
# Configuration used for generating PDF Receipts/Invoices
PDF_RECEIPT_TAX_ID = 'add here'
PDF_RECEIPT_FOOTER_TEXT = 'add your own specific footer text here'
PDF_RECEIPT_DISCLAIMER_TEXT = 'add your own specific disclaimer text here'
PDF_RECEIPT_BILLING_ADDRESS = 'add your own billing address here with appropriate line feed characters'
PDF_RECEIPT_TERMS_AND_CONDITIONS = 'add your own terms and conditions'
PDF_RECEIPT_TAX_ID_LABEL = 'Tax ID'
PDF_RECEIPT_LOGO_PATH = PROJECT_ROOT + '/static/images/openedx-logo-tag.png'
# Height of the Logo in mm
PDF_RECEIPT_LOGO_HEIGHT_MM = 12
2689
PDF_RECEIPT_COBRAND_LOGO_PATH = PROJECT_ROOT + '/static/images/logo.png'
2690 2691
# Height of the Co-brand Logo in mm
PDF_RECEIPT_COBRAND_LOGO_HEIGHT_MM = 12
2692 2693

# Use None for the default search engine
2694
SEARCH_ENGINE = None
2695 2696
# Use LMS specific search initializer
SEARCH_INITIALIZER = "lms.lib.courseware_search.lms_search_initializer.LmsSearchInitializer"
2697 2698
# Use the LMS specific result processor
SEARCH_RESULT_PROCESSOR = "lms.lib.courseware_search.lms_result_processor.LmsSearchResultProcessor"
2699 2700
# Use the LMS specific filter generator
SEARCH_FILTER_GENERATOR = "lms.lib.courseware_search.lms_filter_generator.LmsSearchFilterGenerator"
2701 2702
# Override to skip enrollment start date filtering in course search
SEARCH_SKIP_ENROLLMENT_START_DATE_FILTERING = False
Andy Armstrong committed
2703

2704 2705
### PERFORMANCE EXPERIMENT SETTINGS ###
# CDN experiment/monitoring flags
2706 2707
CDN_VIDEO_URLS = {}

2708 2709 2710
# Page onload event sampling rate (min 0.0, max 1.0)
ONLOAD_BEACON_SAMPLE_RATE = 0.0

2711 2712
# The configuration visibility of account fields.
ACCOUNT_VISIBILITY_CONFIGURATION = {
Andy Armstrong committed
2713 2714
    # Default visibility level for accounts without a specified value
    # The value is one of: 'all_users', 'private'
2715
    "default_visibility": "all_users",
Andy Armstrong committed
2716

2717 2718
    # The list of all fields that can be shared with other users
    "shareable_fields": [
Andy Armstrong committed
2719 2720 2721 2722
        'username',
        'profile_image',
        'country',
        'time_zone',
2723
        'language_proficiencies',
Andy Armstrong committed
2724
        'bio',
2725
        'account_privacy',
2726 2727
        # Not an actual field, but used to signal whether badges should be public.
        'accomplishments_shared',
Andy Armstrong committed
2728 2729
    ],

2730
    # The list of account fields that are always public
Andy Armstrong committed
2731 2732 2733
    "public_fields": [
        'username',
        'profile_image',
2734
        'account_privacy',
Andy Armstrong committed
2735
    ],
2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753

    # The list of account fields that are visible only to staff and users viewing their own profiles
    "admin_fields": [
        "username",
        "email",
        "date_joined",
        "is_active",
        "bio",
        "country",
        "profile_image",
        "language_proficiencies",
        "name",
        "gender",
        "goals",
        "year_of_birth",
        "level_of_education",
        "mailing_address",
        "requires_parental_consent",
2754
        "account_privacy",
2755
        "accomplishments_shared",
2756
    ]
Andy Armstrong committed
2757
}
2758 2759

# E-Commerce API Configuration
2760
ECOMMERCE_PUBLIC_URL_ROOT = None
2761 2762 2763
ECOMMERCE_API_URL = None
ECOMMERCE_API_SIGNING_KEY = None
ECOMMERCE_API_TIMEOUT = 5
2764
ECOMMERCE_SERVICE_WORKER_USERNAME = 'ecommerce_worker'
2765

2766 2767
COURSE_CATALOG_API_URL = None

2768
# Reverification checkpoint name pattern
2769
CHECKPOINT_PATTERN = r'(?P<checkpoint_name>[^/]+)'
2770 2771 2772 2773 2774 2775

# For the fields override feature
# If using FEATURES['INDIVIDUAL_DUE_DATES'], you should add
# 'courseware.student_field_overrides.IndividualStudentOverrideProvider' to
# this setting.
FIELD_OVERRIDE_PROVIDERS = ()
2776

2777 2778 2779 2780
# Modulestore-level field override providers. These field override providers don't
# require student context.
MODULESTORE_FIELD_OVERRIDE_PROVIDERS = ()

2781
# PROFILE IMAGE CONFIG
2782
# WARNING: Certain django storage backends do not support atomic
2783
# file overwrites (including the default, OverwriteStorage) - instead
2784 2785 2786 2787
# there are separate calls to delete and then write a new file in the
# storage backend.  This introduces the risk of a race condition
# occurring when a user uploads a new profile image to replace an
# earlier one (the file will temporarily be deleted).
2788 2789 2790 2791 2792 2793 2794
PROFILE_IMAGE_BACKEND = {
    'class': 'storages.backends.overwrite.OverwriteStorage',
    'options': {
        'location': os.path.join(MEDIA_ROOT, 'profile-images/'),
        'base_url': os.path.join(MEDIA_URL, 'profile-images/'),
    },
}
2795
PROFILE_IMAGE_DEFAULT_FILENAME = 'images/profiles/default'
2796
PROFILE_IMAGE_DEFAULT_FILE_EXTENSION = 'png'
2797 2798 2799 2800 2801
# This secret key is used in generating unguessable URLs to users'
# profile images.  Once it has been set, changing it will make the
# platform unaware of current image URLs, resulting in reverting all
# users' profile images to the default placeholder image.
PROFILE_IMAGE_SECRET_KEY = 'placeholder secret key'
2802 2803
PROFILE_IMAGE_MAX_BYTES = 1024 * 1024
PROFILE_IMAGE_MIN_BYTES = 100
2804

2805 2806 2807
# Sets the maximum number of courses listed on the homepage
# If set to None, all courses will be listed on the homepage
HOMEPAGE_COURSE_MAX = None
2808

2809
################################ Settings for Credit Courses ################################
2810 2811 2812 2813 2814 2815 2816 2817
# Initial delay used for retrying tasks.
# Additional retries use longer delays.
# Value is in seconds.
CREDIT_TASK_DEFAULT_RETRY_DELAY = 30

# Maximum number of retries per task for errors that are not related
# to throttling.
CREDIT_TASK_MAX_RETRIES = 5
2818

2819
# Dummy secret key for dev/test
Usman Khalid committed
2820
SECRET_KEY = 'dev key'
2821

2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832
# Secret keys shared with credit providers.
# Used to digitally sign credit requests (us --> provider)
# and validate responses (provider --> us).
# Each key in the dictionary is a credit provider ID, and
# the value is the 32-character key.
CREDIT_PROVIDER_SECRET_KEYS = {}

# Maximum age in seconds of timestamps we will accept
# when a credit provider notifies us that a student has been approved
# or denied for credit.
CREDIT_PROVIDER_TIMESTAMP_EXPIRATION = 15 * 60
2833

2834 2835 2836
# The Help link to the FAQ page about the credit
CREDIT_HELP_LINK_URL = "#"

2837 2838 2839 2840 2841
# Default domain for the e-mail address associated with users who are created
# via the LTI Provider feature. Note that the generated e-mail addresses are
# not expected to be active; this setting simply allows administrators to
# route any messages intended for LTI users to a common domain.
LTI_USER_EMAIL_DOMAIN = 'lti.example.com'
2842

2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854
# An aggregate score is one derived from multiple problems (such as the
# cumulative score for a vertical element containing many problems). Sending
# aggregate scores immediately introduces two issues: one is a race condition
# between the view method and the Celery task where the updated score may not
# yet be visible to the database if the view has not yet returned (and committed
# its transaction). The other is that the student is likely to receive a stream
# of notifications as the score is updated with every problem. Waiting a
# reasonable period of time allows the view transaction to end, and allows us to
# collapse multiple score updates into a single message.
# The time value is in seconds.
LTI_AGGREGATE_SCORE_PASSBACK_DELAY = 15 * 60

2855

2856 2857 2858 2859
# For help generating a key pair import and run `openedx.core.lib.rsa_key_utils.generate_rsa_key_pair()`
PUBLIC_RSA_KEY = None
PRIVATE_RSA_KEY = None

2860 2861 2862
# Credit notifications settings
NOTIFICATION_EMAIL_CSS = "templates/credit_notifications/credit_notification.css"
NOTIFICATION_EMAIL_EDX_LOGO = "templates/credit_notifications/edx-logo-header.png"
2863

2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878

################################ Settings for Microsites ################################

### Select an implementation for the microsite backend
# for MICROSITE_BACKEND possible choices are
# 1. microsite_configuration.backends.filebased.FilebasedMicrositeBackend
# 2. microsite_configuration.backends.database.DatabaseMicrositeBackend
MICROSITE_BACKEND = 'microsite_configuration.backends.filebased.FilebasedMicrositeBackend'
# for MICROSITE_TEMPLATE_BACKEND possible choices are
# 1. microsite_configuration.backends.filebased.FilebasedMicrositeTemplateBackend
# 2. microsite_configuration.backends.database.DatabaseMicrositeTemplateBackend
MICROSITE_TEMPLATE_BACKEND = 'microsite_configuration.backends.filebased.FilebasedMicrositeTemplateBackend'
# TTL for microsite database template cache
MICROSITE_DATABASE_TEMPLATE_CACHE_TTL = 5 * 60

2879 2880 2881
################################ Settings for rss_proxy ################################

RSS_PROXY_CACHE_TIMEOUT = 3600  # The length of time we cache RSS retrieved from remote URLs in seconds
2882

2883 2884 2885 2886 2887 2888 2889
#### PROCTORING CONFIGURATION DEFAULTS

PROCTORING_BACKEND_PROVIDER = {
    'class': 'edx_proctoring.backends.null.NullBackendProvider',
    'options': {},
}
PROCTORING_SETTINGS = {}
2890 2891 2892 2893 2894 2895 2896

#### Custom Courses for EDX (CCX) configuration

# This is an arbitrary hard limit.
# The reason we introcuced this number is because we do not want the CCX
# to compete with the MOOC.
CCX_MAX_STUDENTS_ALLOWED = 200
2897 2898 2899 2900 2901 2902 2903

# Financial assistance settings

# Maximum and minimum length of answers, in characters, for the
# financial assistance form
FINANCIAL_ASSISTANCE_MIN_LENGTH = 800
FINANCIAL_ASSISTANCE_MAX_LENGTH = 2500
2904 2905 2906

# Course Content Bookmarks Settings
MAX_BOOKMARKS_PER_COURSE = 100
2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917

#### Registration form extension. ####
# Only used if combined login/registration is enabled.
# This can be used to add fields to the registration page.
# It must be a path to a valid form, in dot-separated syntax.
# IE: custom_form_app.forms.RegistrationExtensionForm
# Note: If you want to use a model to store the results of the form, you will
# need to add the model's app to the ADDL_INSTALLED_APPS array in your
# lms.env.json file.

REGISTRATION_EXTENSION_FORM = None
2918 2919 2920 2921 2922

# Identifier included in the User Agent from open edX mobile apps.
MOBILE_APP_USER_AGENT_REGEXES = [
    r'edX/org.edx.mobile',
]
2923

2924 2925 2926
# cache timeout in seconds for Mobile App Version Upgrade
APP_UPGRADE_CACHE_TIMEOUT = 3600

2927
# Offset for courseware.StudentModuleHistoryExtended which is used to
2928 2929 2930 2931
# calculate the starting primary key for the underlying table.  This gap
# should be large enough that you do not generate more than N courseware.StudentModuleHistory
# records before you have deployed the app to write to coursewarehistoryextended.StudentModuleHistoryExtended
# if you want to avoid an overlap in ids while searching for history across the two tables.
2932 2933
STUDENTMODULEHISTORYEXTENDED_OFFSET = 10000

2934 2935 2936 2937
# Cutoff date for granting audit certificates

AUDIT_CERT_CUTOFF_DATE = None

2938 2939 2940
################################ Settings for Credentials Service ################################

CREDENTIALS_SERVICE_USERNAME = 'credentials_service_user'
2941
CREDENTIALS_GENERATION_ROUTING_KEY = HIGH_PRIORITY_QUEUE
2942 2943 2944

WIKI_REQUEST_CACHE_MIDDLEWARE_CLASS = "request_cache.middleware.RequestCache"

2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959
# Settings for Comprehensive Theming app

# See https://github.com/edx/edx-django-sites-extensions for more info
# Default site to use if site matching request headers does not exist
SITE_ID = 1

# dir containing all themes
COMPREHENSIVE_THEME_DIRS = [REPO_ROOT / "themes"]

# Theme to use when no site or site theme is defined,
# set to None if you want to use openedx theme
DEFAULT_SITE_THEME = None

ENABLE_COMPREHENSIVE_THEMING = True

2960 2961 2962
# API access management
API_ACCESS_MANAGER_EMAIL = 'api-access@example.com'
API_ACCESS_FROM_EMAIL = 'api-requests@example.com'
2963 2964
API_DOCUMENTATION_URL = 'http://course-catalog-api-guide.readthedocs.io/en/latest/'
AUTH_DOCUMENTATION_URL = 'http://course-catalog-api-guide.readthedocs.io/en/latest/authentication/index.html'
2965 2966 2967

# Affiliate cookie tracking
AFFILIATE_COOKIE_NAME = 'affiliate_id'
2968 2969 2970 2971 2972 2973 2974

############## Settings for RedirectMiddleware ###############

# Setting this to None causes Redirect data to never expire
# The cache is cleared when Redirect models are saved/deleted
REDIRECT_CACHE_TIMEOUT = None  # The length of time we cache Redirect model data
REDIRECT_CACHE_KEY_PREFIX = 'redirects'
2975 2976 2977 2978 2979

############## Settings for Neo4j ############################

# This should be set in configuration
NEO4J_CONFIG = None
2980 2981 2982 2983

############## Settings for LMS Context Sensitive Help ##############

DOC_LINK_BASE_URL = None