Background: I use private.py a lot in my devstack for my private configurations. But issues are raised when I need to change/override a setting that is defined in devstack_docker.py file. Since that file's contents are loaded after private.py, my private.py is useless against the settings in devstack_docker.py. Description: Now that the devstack is dockerized, I think it makes more sense to import the private.py in the devstack_docker.py files i.e. at the end of configuration files hierarchy.
296 lines
11 KiB
Python
296 lines
11 KiB
Python
"""
|
|
Specific overrides to the base prod settings to make development easier.
|
|
"""
|
|
|
|
|
|
# Silence noisy logs
|
|
import logging
|
|
from os.path import abspath, dirname, join
|
|
|
|
from corsheaders.defaults import default_headers as corsheaders_default_headers
|
|
|
|
# pylint: enable=unicode-format-string
|
|
#####################################################################
|
|
from openedx.core.djangoapps.plugins import constants as plugin_constants
|
|
from openedx.core.djangoapps.plugins import plugin_settings
|
|
|
|
from .production import * # pylint: disable=wildcard-import, unused-wildcard-import
|
|
|
|
# Don't use S3 in devstack, fall back to filesystem
|
|
del DEFAULT_FILE_STORAGE
|
|
MEDIA_ROOT = "/edx/var/edxapp/uploads"
|
|
ORA2_FILEUPLOAD_BACKEND = 'django'
|
|
|
|
|
|
DEBUG = True
|
|
USE_I18N = True
|
|
DEFAULT_TEMPLATE_ENGINE['OPTIONS']['debug'] = True
|
|
SITE_NAME = 'localhost:8000'
|
|
# By default don't use a worker, execute tasks as if they were local functions
|
|
CELERY_ALWAYS_EAGER = True
|
|
HTTPS = 'off'
|
|
|
|
LMS_ROOT_URL = "http://localhost:8000"
|
|
LMS_INTERNAL_ROOT_URL = LMS_ROOT_URL
|
|
ENTERPRISE_API_URL = LMS_INTERNAL_ROOT_URL + '/enterprise/api/v1/'
|
|
IDA_LOGOUT_URI_LIST = [
|
|
'http://localhost:18130/logout/', # ecommerce
|
|
'http://localhost:18150/logout/', # credentials
|
|
'http://localhost:18381/logout/', # discovery
|
|
]
|
|
|
|
################################ LOGGERS ######################################
|
|
|
|
LOG_OVERRIDES = [
|
|
('track.contexts', logging.CRITICAL),
|
|
('track.middleware', logging.CRITICAL),
|
|
('lms.djangoapps.discussion.django_comment_client.utils', logging.CRITICAL),
|
|
]
|
|
for log_name, log_level in LOG_OVERRIDES:
|
|
logging.getLogger(log_name).setLevel(log_level)
|
|
|
|
|
|
################################ EMAIL ########################################
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
|
|
EMAIL_FILE_PATH = '/edx/src/ace_messages/'
|
|
|
|
############################ PYFS XBLOCKS SERVICE #############################
|
|
# Set configuration for Django pyfilesystem
|
|
|
|
DJFS = {
|
|
'type': 'osfs',
|
|
'directory_root': 'lms/static/djpyfs',
|
|
'url_root': '/static/djpyfs',
|
|
}
|
|
|
|
################################ DEBUG TOOLBAR ################################
|
|
|
|
INSTALLED_APPS += ['debug_toolbar']
|
|
MIDDLEWARE += [
|
|
'lms.djangoapps.discussion.django_comment_client.utils.QueryCountDebugMiddleware',
|
|
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
|
]
|
|
|
|
INTERNAL_IPS = ('127.0.0.1',)
|
|
|
|
DEBUG_TOOLBAR_PANELS = (
|
|
'debug_toolbar.panels.versions.VersionsPanel',
|
|
'debug_toolbar.panels.timer.TimerPanel',
|
|
'debug_toolbar.panels.settings.SettingsPanel',
|
|
'debug_toolbar.panels.headers.HeadersPanel',
|
|
'debug_toolbar.panels.request.RequestPanel',
|
|
'debug_toolbar.panels.sql.SQLPanel',
|
|
'debug_toolbar.panels.signals.SignalsPanel',
|
|
'debug_toolbar.panels.logging.LoggingPanel',
|
|
# ProfilingPanel has been intentionally removed for default devstack.py
|
|
# runtimes for performance reasons. If you wish to re-enable it in your
|
|
# local development environment, please create a new settings file
|
|
# that imports and extends devstack.py.
|
|
)
|
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
'SHOW_TOOLBAR_CALLBACK': 'lms.envs.devstack.should_show_debug_toolbar',
|
|
}
|
|
|
|
|
|
def should_show_debug_toolbar(request):
|
|
# We always want the toolbar on devstack unless running tests from another Docker container
|
|
if request.get_host().startswith('edx.devstack.lms:'):
|
|
return False
|
|
return True
|
|
|
|
########################### PIPELINE #################################
|
|
|
|
PIPELINE['PIPELINE_ENABLED'] = False
|
|
STATICFILES_STORAGE = 'openedx.core.storage.DevelopmentStorage'
|
|
|
|
# Revert to the default set of finders as we don't want the production pipeline
|
|
STATICFILES_FINDERS = [
|
|
'openedx.core.djangoapps.theming.finders.ThemeFilesFinder',
|
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
]
|
|
|
|
# Disable JavaScript compression in development
|
|
PIPELINE['JS_COMPRESSOR'] = None
|
|
|
|
# Whether to run django-require in debug mode.
|
|
REQUIRE_DEBUG = DEBUG
|
|
|
|
PIPELINE['SASS_ARGUMENTS'] = '--debug-info'
|
|
|
|
# Load development webpack donfiguration
|
|
WEBPACK_CONFIG_PATH = 'webpack.dev.config.js'
|
|
|
|
########################### VERIFIED CERTIFICATES #################################
|
|
|
|
FEATURES['AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'] = True
|
|
FEATURES['ENABLE_PAYMENT_FAKE'] = True
|
|
|
|
CC_PROCESSOR_NAME = 'CyberSource2'
|
|
CC_PROCESSOR = {
|
|
'CyberSource2': {
|
|
"PURCHASE_ENDPOINT": '/shoppingcart/payment_fake/',
|
|
"SECRET_KEY": 'abcd123',
|
|
"ACCESS_KEY": 'abcd123',
|
|
"PROFILE_ID": 'edx',
|
|
}
|
|
}
|
|
|
|
########################### External REST APIs #################################
|
|
FEATURES['ENABLE_OAUTH2_PROVIDER'] = True
|
|
FEATURES['ENABLE_MOBILE_REST_API'] = True
|
|
FEATURES['ENABLE_VIDEO_ABSTRACTION_LAYER_API'] = True
|
|
|
|
########################## SECURITY #######################
|
|
FEATURES['ENABLE_MAX_FAILED_LOGIN_ATTEMPTS'] = False
|
|
FEATURES['SQUELCH_PII_IN_LOGS'] = False
|
|
FEATURES['PREVENT_CONCURRENT_LOGINS'] = False
|
|
|
|
########################### Milestones #################################
|
|
FEATURES['MILESTONES_APP'] = True
|
|
|
|
########################### Milestones #################################
|
|
FEATURES['ORGANIZATIONS_APP'] = True
|
|
|
|
########################### Entrance Exams #################################
|
|
FEATURES['ENTRANCE_EXAMS'] = True
|
|
|
|
################################ COURSE LICENSES ################################
|
|
FEATURES['LICENSING'] = True
|
|
|
|
|
|
########################## Courseware Search #######################
|
|
FEATURES['ENABLE_COURSEWARE_SEARCH'] = True
|
|
SEARCH_ENGINE = "search.elastic.ElasticSearchEngine"
|
|
|
|
|
|
########################## Dashboard Search #######################
|
|
FEATURES['ENABLE_DASHBOARD_SEARCH'] = True
|
|
|
|
|
|
########################## Certificates Web/HTML View #######################
|
|
FEATURES['CERTIFICATES_HTML_VIEW'] = True
|
|
|
|
|
|
########################## Course Discovery #######################
|
|
LANGUAGE_MAP = {'terms': {lang: display for lang, display in ALL_LANGUAGES}, 'name': 'Language'}
|
|
COURSE_DISCOVERY_MEANINGS = {
|
|
'org': {
|
|
'name': 'Organization',
|
|
},
|
|
'modes': {
|
|
'name': 'Course Type',
|
|
'terms': {
|
|
'honor': 'Honor',
|
|
'verified': 'Verified',
|
|
},
|
|
},
|
|
'language': LANGUAGE_MAP,
|
|
}
|
|
|
|
FEATURES['ENABLE_COURSE_DISCOVERY'] = True
|
|
# Setting for overriding default filtering facets for Course discovery
|
|
# COURSE_DISCOVERY_FILTERS = ["org", "language", "modes"]
|
|
FEATURES['COURSES_ARE_BROWSEABLE'] = True
|
|
HOMEPAGE_COURSE_MAX = 9
|
|
|
|
# Software secure fake page feature flag
|
|
FEATURES['ENABLE_SOFTWARE_SECURE_FAKE'] = True
|
|
|
|
# Setting for the testing of Software Secure Result Callback
|
|
VERIFY_STUDENT["SOFTWARE_SECURE"] = {
|
|
"API_ACCESS_KEY": "BBBBBBBBBBBBBBBBBBBB",
|
|
"API_SECRET_KEY": "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC",
|
|
}
|
|
DISABLE_ACCOUNT_ACTIVATION_REQUIREMENT_SWITCH = "verify_student_disable_account_activation_requirement"
|
|
|
|
# Skip enrollment start date filtering
|
|
SEARCH_SKIP_ENROLLMENT_START_DATE_FILTERING = True
|
|
|
|
|
|
########################## Shopping cart ##########################
|
|
FEATURES['ENABLE_SHOPPING_CART'] = True
|
|
FEATURES['STORE_BILLING_INFO'] = True
|
|
FEATURES['ENABLE_PAID_COURSE_REGISTRATION'] = True
|
|
FEATURES['ENABLE_COSMETIC_DISPLAY_PRICE'] = True
|
|
|
|
######################### Program Enrollments #####################
|
|
FEATURES['ENABLE_ENROLLMENT_RESET'] = True
|
|
|
|
######################### New Courseware MFE #####################
|
|
FEATURES['ENABLE_COURSEWARE_MICROFRONTEND'] = True
|
|
|
|
########################## Third Party Auth #######################
|
|
|
|
if FEATURES.get('ENABLE_THIRD_PARTY_AUTH') and 'third_party_auth.dummy.DummyBackend' not in AUTHENTICATION_BACKENDS:
|
|
AUTHENTICATION_BACKENDS = ['third_party_auth.dummy.DummyBackend'] + list(AUTHENTICATION_BACKENDS)
|
|
|
|
############## ECOMMERCE API CONFIGURATION SETTINGS ###############
|
|
ECOMMERCE_PUBLIC_URL_ROOT = "http://localhost:8002"
|
|
|
|
############################### BLOCKSTORE #####################################
|
|
BLOCKSTORE_API_URL = "http://edx.devstack.blockstore:18250/api/v1/"
|
|
|
|
###################### Cross-domain requests ######################
|
|
FEATURES['ENABLE_CORS_HEADERS'] = True
|
|
CORS_ALLOW_CREDENTIALS = True
|
|
CORS_ORIGIN_WHITELIST = ()
|
|
CORS_ORIGIN_ALLOW_ALL = True
|
|
CORS_ALLOW_HEADERS = corsheaders_default_headers + (
|
|
'use-jwt-cookie',
|
|
)
|
|
|
|
LOGIN_REDIRECT_WHITELIST = [CMS_BASE]
|
|
|
|
###################### JWTs ######################
|
|
# pylint: disable=unicode-format-string
|
|
JWT_AUTH.update({
|
|
'JWT_ISSUER': 'http://127.0.0.1:8000/oauth2',
|
|
'JWT_AUDIENCE': 'lms-key',
|
|
'JWT_SECR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DNe2K2dunddFqCOdvLXr7ydRcK51ZwSeHjcjgD1aJkHA'
|
|
'9i1zqyboxgd0uAbxVDo6ohnlVqYLtap2tXXcavKm4C9MTpob_rk6FBfEuq4uSsuxFvCER4yG3CYBBa4gZVU", "kid": "devstack_key", "'
|
|
'kty": "RSA"}'
|
|
),
|
|
'JWT_PUBLIC_SIGNING_JWK_SET': (
|
|
'{"keys": [{"kid": "devstack_key", "e": "AQAB", "kty": "RSA", "n": "smKFSYowG6nNUAdeqH1jQQnH1PmIHphzBmwJ5vRf1vu'
|
|
'48BUI5VcVtUWIPqzRK_LDSlZYh9D0YFL0ZTxIrlb6Tn3Xz7pYvpIAeYuQv3_H5p8tbz7Fb8r63c1828wXPITVTv8f7oxx5W3lFFgpFAyYMmROC'
|
|
'4Ee9qG5T38LFe8_oAuFCEntimWxN9F3P-FJQy43TL7wG54WodgiM0EgzkeLr5K6cDnyckWjTuZbWI-4ffcTgTZsL_Kq1owa_J2ngEfxMCObnzG'
|
|
'y5ZLcTUomo4rZLjghVpq6KZxfS6I1Vz79ZsMVUWEdXOYePCKKsrQG20ogQEkmTf9FT_SouC6jPcHLXw"}]}'
|
|
),
|
|
})
|
|
plugin_settings.add_plugins(__name__, plugin_constants.ProjectType.LMS, plugin_constants.SettingsType.DEVSTACK)
|
|
|
|
|
|
######################### Django Rest Framework ########################
|
|
|
|
REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES'] += (
|
|
'rest_framework.renderers.BrowsableAPIRenderer',
|
|
)
|
|
|
|
OPENAPI_CACHE_TIMEOUT = 0
|
|
|
|
#####################################################################
|
|
# Lastly, run any migrations, if needed.
|
|
MODULESTORE = convert_module_store_setting_if_needed(MODULESTORE)
|
|
|
|
SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
|
|
|
|
EDXNOTES_INTERNAL_API = 'http://edx.devstack.edxnotesapi:18120/api/v1'
|
|
EDXNOTES_CLIENT_NAME = 'edx_notes_api-backend-service'
|
|
|
|
############## Settings for Microfrontends #########################
|
|
LEARNING_MICROFRONTEND_URL = 'http://localhost:2000'
|