Skip to content
Snippets Groups Projects
common.py 147 KiB
Newer Older
# -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change the feature
configuration in an environment specific config file and re-calculate those
values.

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

Longer TODO:
1. Right now our treatment of static content in general and in particular
   course-specific static content is haphazard.
2. We should have a more disciplined approach to feature flagging, even if it
   just means that we stick them in a dict called FEATURES.
3. We need to handle configuration for multiple courses. This could be as
   multiple sites, but we do need a way to map their data assets.
"""
# We intentionally define lots of variables that aren't used
# pylint: disable=unused-import
# 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
import importlib.util
from corsheaders.defaults import default_headers as corsheaders_default_headers
from path import Path as path
from django.utils.translation import ugettext_lazy as _
from enterprise.constants import (
    ENTERPRISE_ADMIN_ROLE,
    ENTERPRISE_CATALOG_ADMIN_ROLE,
    ENTERPRISE_DASHBOARD_ADMIN_ROLE,
    ENTERPRISE_ENROLLMENT_API_ADMIN_ROLE,
    ENTERPRISE_REPORTING_CONFIG_ADMIN_ROLE,
Bill DeRusha's avatar
Bill DeRusha committed
from openedx.core.constants import COURSE_KEY_REGEX, COURSE_KEY_PATTERN, COURSE_ID_PATTERN
from openedx.core.djangoapps.theming.helpers_dirs import (
    get_themes_unchecked,
    get_theme_base_dirs_from_settings
)
from openedx.core.lib.derived import derived, derived_collection_entry
from openedx.core.release import doc_version
from xmodule.modulestore.modulestore_settings import update_module_store_settings
from xmodule.modulestore.edit_info import EditInfoMixin
from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin
Calen Pennington's avatar
Calen Pennington committed

################################### FEATURES ###################################
# The display name of the platform to be used in templates/emails/etc.
PLATFORM_NAME = _('Your Platform Name Here')
PLATFORM_DESCRIPTION = _('Your Platform Description Here')
CC_MERCHANT_NAME = PLATFORM_NAME
PLATFORM_FACEBOOK_ACCOUNT = "http://www.facebook.com/YourPlatformFacebookAccount"
PLATFORM_TWITTER_ACCOUNT = "@YourPlatformTwitterAccount"
nadeemshahzad's avatar
nadeemshahzad committed
LMS_ROOT_URL = 'https://localhost:18000'
LMS_INTERNAL_ROOT_URL = LMS_ROOT_URL
LMS_ENROLLMENT_API_PATH = "/api/enrollment/v1/"
# Default choices for role dropdown in the membership tab of the instructor dashboard
# This setting is used when a site does not define its own choices via site configuration
MANUAL_ENROLLMENT_ROLE_CHOICES = ['Learner', 'Support', 'Partner']

# List of logout URIs for each IDA that the learner should be logged out of when they logout of the LMS. Only applies to
# IDA for which the social auth flow uses DOT (Django OAuth Toolkit).
IDA_LOGOUT_URI_LIST = []

# Features
    # .. toggle_name: DISPLAY_DEBUG_INFO_TO_STAFF
    # .. toggle_implementation: DjangoSetting
    # .. toggle_default: True
    # .. toggle_description: Add a "Staff Debug" button to course modules for debugging
    #   by course staff.
    # .. toggle_use_cases: ?
    # .. toggle_creation_date: 2015-09-04
    # .. toggle_expiration_date: None
    # .. toggle_warnings: None
    # .. toggle_tickets: https://github.com/edx/edx-platform/pull/2425
    # .. toggle_status: supported
    'DISPLAY_DEBUG_INFO_TO_STAFF': True,
    'DISPLAY_HISTOGRAMS_TO_STAFF': False,  # For large courses this slows down courseware access for staff.
    'REROUTE_ACTIVATION_EMAIL': False,  # nonempty string = address for all activation emails
    # .. toggle_name: DISABLE_START_DATES
    # .. toggle_implementation: DjangoSetting
    # .. toggle_default: False
    # .. toggle_description: When True, all courses will be active, regardless of start
    #   date.
    # .. toggle_use_cases: ?
    # .. toggle_creation_date: ?
    # .. toggle_expiration_date: None
    # .. toggle_warnings: This will cause ALL courses to be immediately visible.
    # .. toggle_tickets: https://github.com/edx/edx-platform/pull/17913
    # .. toggle_status: supported
    ## DO NOT SET TO True IN THIS FILE
    ## Doing so will cause all courses to be released on production
    'DISABLE_START_DATES': False,
    # for consistency in user-experience, keep the value of the following 3 settings
    # in sync with the corresponding ones in cms/envs/common.py
    'ENABLE_DISCUSSION_SERVICE': True,

    # .. toggle_name: ENABLE_TEXTBOOK
    # .. toggle_implementation: DjangoSetting
    # .. toggle_default: True
    # .. toggle_description: Add PDF and HTML textbook tabs to the courseware.
    # .. toggle_use_cases: ?
    # .. toggle_creation_date: 2014-03-27
    # .. toggle_expiration_date: None
    # .. toggle_warnings: None
    # .. toggle_tickets: https://github.com/edx/edx-platform/pull/3064
    # .. toggle_status: supported
    'ENABLE_TEXTBOOK': True,
    # discussion home panel, which includes a subscription on/off setting for discussion digest emails.
    # this should remain off in production until digest notifications are online.
e0d's avatar
e0d committed
    'ENABLE_DISCUSSION_HOME_PANEL': False,
    # .. toggle_name: ENABLE_DISCUSSION_EMAIL_DIGEST
    # .. toggle_implementation: DjangoSetting
    # .. toggle_default: False
    # .. toggle_description: 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.
    # .. toggle_use_cases: open_edx
    # .. toggle_creation_date: 2014-08-19
    # .. toggle_expiration_date: None
    # .. toggle_warnings: 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.
    # .. toggle_tickets: https://github.com/edx/edx-platform/pull/4891
    # .. toggle_status: supported
    # toggle_name: ENABLE_UNICODE_USERNAME
    # toggle_implementation: DjangoSetting
    # toggle_default: False
    # toggle_description: Set this to True to allow unicode characters in username. Enabling this will also
    #   automatically enable SOCIAL_AUTH_CLEAN_USERNAMES. When this is enabled, usernames will have to match the
    #   regular expression defined by USERNAME_REGEX_PARTIAL.
    # toggle_category: admin
    # toggle_use_cases: open_edx
    # toggle_creation_date: 2017-06-27
    # toggle_expiration_date: None
    # toggle_warnings: None
    # toggle_tickets: https://github.com/edx/edx-platform/pull/14729
    # toggle_status: supported
    'ENABLE_UNICODE_USERNAME': False,

    'ENABLE_DJANGO_ADMIN_SITE': True,  # set true to enable django's admin site, even on prod (e.g. for course ops)
    'ENABLE_LMS_MIGRATION': False,

    # .. toggle_name: ENABLE_MASQUERADE
    # .. toggle_implementation: DjangoSetting
    # .. toggle_default: True
    # .. toggle_description: Allow course staff to change to student view of courseware by accessing the
    #   /course/{course_id}/masquerade url.
    # .. toggle_use_cases: ?
    # .. toggle_creation_date: 2013-04-13
    # .. toggle_expiration_date: None
    # .. toggle_warnings: None
    # .. toggle_tickets: None
    # .. toggle_status: supported
    'ENABLE_MASQUERADE': True,
    # .. toggle_name: ENABLE_SYSADMIN_DASHBOARD
    # .. toggle_implementation: DjangoSetting
    # .. toggle_default: False
    # .. toggle_description: enables dashboard at /syadmin/ for django staff, for seeing overview of system status, for
    #   deleting and loading courses, for seeing log of git imports of courseware.
    # .. toggle_use_cases: open_edx
    # .. toggle_creation_date: 2013-12-12
    # .. toggle_expiration_date: None
    # .. toggle_warnings: some views are not performant when there are more than 100 courses
    # .. toggle_tickets: None
    # .. toggle_status: unsupported
Carson Gee's avatar
Carson Gee committed
    'ENABLE_SYSADMIN_DASHBOARD': False,  # sysadmin dashboard, to see what courses are loaded, to delete & load courses

    'DISABLE_LOGIN_BUTTON': False,  # used in systems where login is automatic, eg MIT SSL
    # .. toggle_name: ENABLE_OAUTH2_PROVIDER
    # .. toggle_implementation: DjangoSetting
Loading
Loading full blame...