Collectstatic failed in production when comprehensive theme contained custom css files. This patch fixes that problem by removing ComprehensiveThemeFinder from STATICFILES_FINDERS and ComprehensiveThemingAware mixin from STATICFILES_STORAGE. Comprehensive theme static dirs are added to the top of the STATICFILES_DIRS entry, which means that the default django FilesystemFinder will find theme static files, and since the theme folder is at the top of STATICFILES_DIRS, theme files will take precedence over default LMS/CMS static files. This change means that theme static file URLs are no longer prefixed with themes/<theme-name>/, but since we currently only support one comprehensive theme at a time, that shouldn't be a problem. If/when we want to make the choice of a theme dynamic per-request (microsites?), we will have to bring custom theme finders and storage mixins back, but for now, we don't need them.
244 lines
8.1 KiB
Python
244 lines
8.1 KiB
Python
"""
|
|
Specific overrides to the base prod settings to make development easier.
|
|
"""
|
|
from os.path import abspath, dirname, join
|
|
|
|
from .aws 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"
|
|
|
|
|
|
DEBUG = True
|
|
USE_I18N = True
|
|
DEFAULT_TEMPLATE_ENGINE['OPTIONS']['debug'] = True
|
|
SITE_NAME = 'localhost:8000'
|
|
PLATFORM_NAME = ENV_TOKENS.get('PLATFORM_NAME', 'Devstack')
|
|
# By default don't use a worker, execute tasks as if they were local functions
|
|
CELERY_ALWAYS_EAGER = True
|
|
HTTPS = 'off'
|
|
|
|
################################ LOGGERS ######################################
|
|
|
|
# Silence noisy logs
|
|
import logging
|
|
LOG_OVERRIDES = [
|
|
('track.contexts', logging.CRITICAL),
|
|
('track.middleware', logging.CRITICAL),
|
|
('dd.dogapi', logging.CRITICAL),
|
|
('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.console.EmailBackend'
|
|
FEATURES['ENABLE_INSTRUCTOR_EMAIL'] = True # Enable email for all Studio courses
|
|
FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False # Give all courses email (don't require django-admin perms)
|
|
|
|
|
|
########################## ANALYTICS TESTING ########################
|
|
|
|
ANALYTICS_SERVER_URL = "http://127.0.0.1:9000/"
|
|
ANALYTICS_API_KEY = ""
|
|
|
|
# Set this to the dashboard URL in order to display the link from the
|
|
# dashboard to the Analytics Dashboard.
|
|
ANALYTICS_DASHBOARD_URL = None
|
|
|
|
############################ 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', 'debug_toolbar_mongo')
|
|
MIDDLEWARE_CLASSES += (
|
|
'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',
|
|
'debug_toolbar_mongo.panel.MongoDebugPanel',
|
|
# 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(_):
|
|
return True # We always want the toolbar on devstack regardless of IP, auth, etc.
|
|
|
|
|
|
########################### 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 = [
|
|
'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 --require {proj_dir}/static/sass/bourbon/lib/bourbon.rb'.format(proj_dir=PROJECT_ROOT)
|
|
|
|
########################### 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
|
|
OAUTH_OIDC_ISSUER = 'http://127.0.0.1:8000/oauth2'
|
|
FEATURES['ENABLE_MOBILE_REST_API'] = True
|
|
FEATURES['ENABLE_VIDEO_ABSTRACTION_LAYER_API'] = True
|
|
|
|
########################## SECURITY #######################
|
|
FEATURES['ENFORCE_PASSWORD_POLICY'] = False
|
|
FEATURES['ENABLE_MAX_FAILED_LOGIN_ATTEMPTS'] = False
|
|
FEATURES['SQUELCH_PII_IN_LOGS'] = False
|
|
FEATURES['PREVENT_CONCURRENT_LOGINS'] = False
|
|
FEATURES['ADVANCED_SECURITY'] = False
|
|
PASSWORD_MIN_LENGTH = None
|
|
PASSWORD_COMPLEXITY = {}
|
|
|
|
|
|
########################### 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",
|
|
}
|
|
|
|
# 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
|
|
|
|
########################## 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"
|
|
|
|
###################### Cross-domain requests ######################
|
|
FEATURES['ENABLE_CORS_HEADERS'] = True
|
|
CORS_ALLOW_CREDENTIALS = True
|
|
CORS_ORIGIN_WHITELIST = ()
|
|
CORS_ORIGIN_ALLOW_ALL = True
|
|
|
|
# JWT settings for devstack
|
|
JWT_AUTH.update({
|
|
'JWT_ALGORITHM': 'HS256',
|
|
'JWT_SECRET_KEY': 'lms-secret',
|
|
'JWT_ISSUER': 'http://127.0.0.1:8000/oauth2',
|
|
'JWT_AUDIENCE': 'lms-key',
|
|
})
|
|
|
|
#####################################################################
|
|
# See if the developer has any local overrides.
|
|
if os.path.isfile(join(dirname(abspath(__file__)), 'private.py')):
|
|
from .private import * # pylint: disable=import-error,wildcard-import
|
|
|
|
#####################################################################
|
|
# Lastly, run any migrations, if needed.
|
|
MODULESTORE = convert_module_store_setting_if_needed(MODULESTORE)
|
|
|
|
SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
|