Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ omit =
common/djangoapps/*/migrations/*
openedx/core/djangoapps/*/migrations/*
openedx/core/djangoapps/debug/*
openedx/envs/*
openedx/features/*/migrations/*

concurrency=multiprocessing
Expand Down
1 change: 1 addition & 0 deletions .coveragerc-local
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ omit =
common/djangoapps/*/migrations/*
openedx/core/djangoapps/*/migrations/*
openedx/core/djangoapps/debug/*
openedx/envs/*
openedx/features/*/migrations/*

concurrency=multiprocessing
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pylint-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- module-name: openedx-1
path: "openedx/core/types/ openedx/core/djangoapps/ace_common/ openedx/core/djangoapps/agreements/ openedx/core/djangoapps/api_admin/ openedx/core/djangoapps/auth_exchange/ openedx/core/djangoapps/bookmarks/ openedx/core/djangoapps/cache_toolbox/ openedx/core/djangoapps/catalog/ openedx/core/djangoapps/ccxcon/ openedx/core/djangoapps/commerce/ openedx/core/djangoapps/common_initialization/ openedx/core/djangoapps/common_views/ openedx/core/djangoapps/config_model_utils/ openedx/core/djangoapps/content/ openedx/core/djangoapps/content_libraries/ openedx/core/djangoapps/content_staging/ openedx/core/djangoapps/contentserver/ openedx/core/djangoapps/cookie_metadata/ openedx/core/djangoapps/cors_csrf/ openedx/core/djangoapps/course_apps/ openedx/core/djangoapps/course_date_signals/ openedx/core/djangoapps/course_groups/ openedx/core/djangoapps/courseware_api/ openedx/core/djangoapps/crawlers/ openedx/core/djangoapps/credentials/ openedx/core/djangoapps/credit/ openedx/core/djangoapps/dark_lang/ openedx/core/djangoapps/debug/ openedx/core/djangoapps/discussions/ openedx/core/djangoapps/django_comment_common/ openedx/core/djangoapps/embargo/ openedx/core/djangoapps/enrollments/ openedx/core/djangoapps/external_user_ids/ openedx/core/djangoapps/zendesk_proxy/ openedx/core/djangolib/ openedx/core/lib/ openedx/core/djangoapps/course_live/"
- module-name: openedx-2
path: "openedx/core/djangoapps/geoinfo/ openedx/core/djangoapps/header_control/ openedx/core/djangoapps/heartbeat/ openedx/core/djangoapps/lang_pref/ openedx/core/djangoapps/models/ openedx/core/djangoapps/monkey_patch/ openedx/core/djangoapps/oauth_dispatch/ openedx/core/djangoapps/olx_rest_api/ openedx/core/djangoapps/password_policy/ openedx/core/djangoapps/plugin_api/ openedx/core/djangoapps/plugins/ openedx/core/djangoapps/profile_images/ openedx/core/djangoapps/programs/ openedx/core/djangoapps/safe_sessions/ openedx/core/djangoapps/schedules/ openedx/core/djangoapps/service_status/ openedx/core/djangoapps/session_inactivity_timeout/ openedx/core/djangoapps/signals/ openedx/core/djangoapps/site_configuration/ openedx/core/djangoapps/system_wide_roles/ openedx/core/djangoapps/theming/ openedx/core/djangoapps/user_api/ openedx/core/djangoapps/user_authn/ openedx/core/djangoapps/util/ openedx/core/djangoapps/verified_track_content/ openedx/core/djangoapps/video_config/ openedx/core/djangoapps/video_pipeline/ openedx/core/djangoapps/waffle_utils/ openedx/core/djangoapps/xblock/ openedx/core/djangoapps/xmodule_django/ openedx/core/tests/ openedx/features/ openedx/testing/ openedx/tests/ openedx/core/djangoapps/notifications/ openedx/core/djangoapps/staticfiles/ openedx/core/djangoapps/content_tagging/"
path: "openedx/core/djangoapps/geoinfo/ openedx/core/djangoapps/header_control/ openedx/core/djangoapps/heartbeat/ openedx/core/djangoapps/lang_pref/ openedx/core/djangoapps/models/ openedx/core/djangoapps/monkey_patch/ openedx/core/djangoapps/oauth_dispatch/ openedx/core/djangoapps/olx_rest_api/ openedx/core/djangoapps/password_policy/ openedx/core/djangoapps/plugin_api/ openedx/core/djangoapps/plugins/ openedx/core/djangoapps/profile_images/ openedx/core/djangoapps/programs/ openedx/core/djangoapps/safe_sessions/ openedx/core/djangoapps/schedules/ openedx/core/djangoapps/service_status/ openedx/core/djangoapps/session_inactivity_timeout/ openedx/core/djangoapps/signals/ openedx/core/djangoapps/site_configuration/ openedx/core/djangoapps/system_wide_roles/ openedx/core/djangoapps/theming/ openedx/core/djangoapps/user_api/ openedx/core/djangoapps/user_authn/ openedx/core/djangoapps/util/ openedx/core/djangoapps/verified_track_content/ openedx/core/djangoapps/video_config/ openedx/core/djangoapps/video_pipeline/ openedx/core/djangoapps/waffle_utils/ openedx/core/djangoapps/xblock/ openedx/core/djangoapps/xmodule_django/ openedx/core/tests/ openedx/features/ openedx/testing/ openedx/tests/ openedx/envs/ openedx/core/djangoapps/notifications/ openedx/core/djangoapps/staticfiles/ openedx/core/djangoapps/content_tagging/"
- module-name: common
path: "common"
- module-name: cms
Expand Down
118 changes: 16 additions & 102 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,103 +45,27 @@

from corsheaders.defaults import default_headers as corsheaders_default_headers
from datetime import timedelta

from django.utils.translation import gettext_lazy as _

import lms.envs.common
# Although this module itself may not use these imported variables, other dependent modules may.
# Warning: Do NOT add any new variables to this list. This is incompatible with future plans to
# have more logical separation between LMS and Studio (CMS). It is also incompatible with the
# direction documented in OEP-45: Configuring and Operating Open edX:
# https://open-edx-proposals.readthedocs.io/en/latest/oep-0045-arch-ops-and-config.html
from lms.envs.common import (
USE_TZ, ALL_LANGUAGES, ASSET_IGNORE_REGEX,
PARENTAL_CONSENT_AGE_LIMIT, REGISTRATION_EMAIL_PATTERNS_ALLOWED,
# The following PROFILE_IMAGE_* settings are included as they are
# indirectly accessed through the email opt-in API, which is
# technically accessible through the CMS via legacy URLs.
PROFILE_IMAGE_BACKEND, PROFILE_IMAGE_DEFAULT_FILENAME, PROFILE_IMAGE_DEFAULT_FILE_EXTENSION,
PROFILE_IMAGE_HASH_SEED, PROFILE_IMAGE_MIN_BYTES, PROFILE_IMAGE_MAX_BYTES, PROFILE_IMAGE_SIZES_MAP,
# The following setting is included as it is used to check whether to
# display credit eligibility table on the CMS or not.
COURSE_MODE_DEFAULTS, DEFAULT_COURSE_ABOUT_IMAGE_URL,

# User-uploaded content
MEDIA_ROOT,
MEDIA_URL,

# Lazy Gettext
_,

# Django REST framework configuration
REST_FRAMEWORK,

STATICI18N_OUTPUT_DIR,

# Heartbeat
HEARTBEAT_CHECKS,
HEARTBEAT_EXTENDED_CHECKS,
HEARTBEAT_CELERY_TIMEOUT,
HEARTBEAT_CELERY_ROUTING_KEY,

# Default site to use if no site exists matching request headers
SITE_ID,

# constants for redirects app
REDIRECT_CACHE_TIMEOUT,
REDIRECT_CACHE_KEY_PREFIX,

# This is required for the migrations in oauth_dispatch.models
# otherwise it fails saying this attribute is not present in Settings
# Although Studio does not enable OAuth2 Provider capability, the new approach
# to generating test databases will discover and try to create all tables
# and this setting needs to be present
OAUTH2_PROVIDER_APPLICATION_MODEL,
JWT_AUTH,

USERNAME_REGEX_PARTIAL,
USERNAME_PATTERN,

# django-debug-toolbar
DEBUG_TOOLBAR_PATCH_SETTINGS,

COURSE_ENROLLMENT_MODES,
CONTENT_TYPE_GATE_GROUP_IDS,

DISABLE_ACCOUNT_ACTIVATION_REQUIREMENT_SWITCH,

GENERATE_PROFILE_SCORES,

# Enterprise service settings
ENTERPRISE_CATALOG_INTERNAL_ROOT_URL,
ENTERPRISE_BACKEND_SERVICE_EDX_OAUTH2_KEY,
ENTERPRISE_BACKEND_SERVICE_EDX_OAUTH2_SECRET,
ENTERPRISE_BACKEND_SERVICE_EDX_OAUTH2_PROVIDER_URL,

# Methods to derive settings
_make_mako_template_dirs,
_make_locale_paths,

# Password Validator Settings
AUTH_PASSWORD_VALIDATORS
)

from openedx.envs.common import * # pylint: disable=wildcard-import

from lms.envs.common import (
Comment thread
wgu-taylor-payne marked this conversation as resolved.
# NOTE: Do not add any new imports here. Use openedx.envs.common instead for
# platform wide settings.

# FIXME: The HIBP settings are only used in the LMS, but CMS unit tests fail
# without them. Perhaps moving some code would allow us to remove these from
# this file.
# this file. GitHub Issue: https://github.com/openedx/edx-platform/issues/36992.
ENABLE_AUTHN_LOGIN_BLOCK_HIBP_POLICY,
ENABLE_AUTHN_LOGIN_NUDGE_HIBP_POLICY,
ENABLE_AUTHN_REGISTER_HIBP_POLICY,
ENABLE_AUTHN_RESET_PASSWORD_HIBP_POLICY,
HIBP_LOGIN_BLOCK_PASSWORD_FREQUENCY_THRESHOLD,
HIBP_LOGIN_NUDGE_PASSWORD_FREQUENCY_THRESHOLD,
HIBP_REGISTRATION_PASSWORD_FREQUENCY_THRESHOLD,

USE_EXTRACTED_WORD_CLOUD_BLOCK,
USE_EXTRACTED_ANNOTATABLE_BLOCK,
USE_EXTRACTED_POLL_QUESTION_BLOCK,
USE_EXTRACTED_LTI_BLOCK,
USE_EXTRACTED_HTML_BLOCK,
USE_EXTRACTED_DISCUSSION_BLOCK,
USE_EXTRACTED_PROBLEM_BLOCK,
USE_EXTRACTED_VIDEO_BLOCK,
)
from path import Path as path
from django.urls import reverse_lazy
Expand Down Expand Up @@ -700,7 +624,7 @@
# Don't look for template source files inside installed applications.
'APP_DIRS': False,
# Instead, look for template source files in these dirs.
'DIRS': Derived(_make_mako_template_dirs),
'DIRS': Derived(make_mako_template_dirs),
# Options specific to this backend.
'OPTIONS': {
'loaders': (
Expand All @@ -719,7 +643,7 @@
'NAME': 'mako',
'BACKEND': 'common.djangoapps.edxmako.backend.Mako',
'APP_DIRS': False,
'DIRS': Derived(_make_mako_template_dirs),
'DIRS': Derived(make_mako_template_dirs),
'OPTIONS': {
'context_processors': CONTEXT_PROCESSORS,
'debug': False,
Expand Down Expand Up @@ -823,12 +747,6 @@
}
]

# 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.
from lms.envs.common import (
COURSE_KEY_PATTERN, COURSE_KEY_REGEX, COURSE_ID_PATTERN, USAGE_KEY_PATTERN, ASSET_KEY_PATTERN
)

######################### CSRF #########################################

# Forwards-compatibility with Django 1.7
Expand Down Expand Up @@ -1254,12 +1172,6 @@
CELERY_TIMEZONE = 'UTC'
TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'en' # http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGES_BIDI = lms.envs.common.LANGUAGES_BIDI

LANGUAGE_COOKIE_NAME = lms.envs.common.LANGUAGE_COOKIE_NAME

LANGUAGES = lms.envs.common.LANGUAGES
LANGUAGE_DICT = dict(LANGUAGES)

# Languages supported for custom course certificate templates
CERTIFICATE_TEMPLATE_LANGUAGES = {
Expand All @@ -1273,8 +1185,6 @@
STATICI18N_FILENAME_FUNCTION = 'statici18n.utils.legacy_filename'
STATICI18N_ROOT = PROJECT_ROOT / "static"

LOCALE_PATHS = Derived(_make_locale_paths)

# Messages
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'

Expand Down Expand Up @@ -1540,6 +1450,10 @@
CELERY_BROKER_USE_SSL = False
CELERY_EVENT_QUEUE_TTL = None

############################## HEARTBEAT ######################################

HEARTBEAT_CELERY_ROUTING_KEY = HIGH_PRIORITY_QUEUE
Comment thread
wgu-taylor-payne marked this conversation as resolved.

############################## Video ##########################################

YOUTUBE = {
Expand Down
10 changes: 8 additions & 2 deletions docs/references/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ This is the list of (non-toggle) Django settings defined in the ``common.py`` mo
.. note::
Toggle settings, which enable or disable a specific feature, are documented in the :ref:`feature toggles <featuretoggles>` section.

LMS settings
Platform-Wide Settings
----------------------

.. settings::
:folder_path: openedx/envs/common.py

LMS Settings
------------

.. settings::
:folder_path: lms/envs/common.py

CMS settings
CMS Settings
------------

.. settings::
Expand Down
Loading
Loading