-
Notifications
You must be signed in to change notification settings - Fork 4.1k
create openedx envs common settings #36941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,83 +45,14 @@ | |
|
||
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.core.constants import COURSE_KEY_REGEX, COURSE_KEY_PATTERN, COURSE_ID_PATTERN | ||
from openedx.envs.common import * # pylint: disable=wildcard-import | ||
|
||
from lms.envs.common import ( | ||
# 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 | ||
|
@@ -700,7 +631,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': ( | ||
|
@@ -719,7 +650,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, | ||
|
@@ -823,12 +754,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 | ||
|
@@ -1253,12 +1178,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 = { | ||
|
@@ -1272,7 +1191,7 @@ | |
STATICI18N_FILENAME_FUNCTION = 'statici18n.utils.legacy_filename' | ||
STATICI18N_ROOT = PROJECT_ROOT / "static" | ||
|
||
LOCALE_PATHS = Derived(_make_locale_paths) | ||
LOCALE_PATHS = Derived(make_locale_paths) | ||
|
||
# Messages | ||
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' | ||
|
@@ -1539,6 +1458,10 @@ | |
CELERY_BROKER_USE_SSL = False | ||
CELERY_EVENT_QUEUE_TTL = None | ||
|
||
############################## HEARTBEAT ###################################### | ||
|
||
HEARTBEAT_CELERY_ROUTING_KEY = HIGH_PRIORITY_QUEUE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
These variables follow a similar pattern in both SERVICE_VARIANT = os.environ.get('SERVICE_VARIANT', 'lms') # 'cms' in cms/envs/common.py
CONFIG_PREFIX = SERVICE_VARIANT + "." if SERVICE_VARIANT else ""
QUEUE_VARIANT = CONFIG_PREFIX.lower()
HIGH_PRIORITY_QUEUE = f'edx.{QUEUE_VARIANT}core.high'
HEARTBEAT_CELERY_ROUTING_KEY = HIGH_PRIORITY_QUEUE So, Is that how we should keep it, or should the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another thing to add here is I can't find anywhere the cms uses |
||
|
||
############################## Video ########################################## | ||
|
||
YOUTUBE = { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,12 @@ 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. | ||
|
||
Open edX settings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a good section title for the settings reference page? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's call it "Platform-Wide Settings". "Open edX" includes things outside of edx-platform (and the openedx/ directory is poorly named). |
||
----------------- | ||
|
||
.. settings:: | ||
:folder_path: openedx/envs/common.py | ||
|
||
LMS settings | ||
------------ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't move these up, since it is unclear whether they belong in the CMS long term.