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.
136 lines
4.5 KiB
Python
136 lines
4.5 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'] = DEBUG
|
|
HTTPS = 'off'
|
|
|
|
################################ LOGGERS ######################################
|
|
|
|
import logging
|
|
|
|
# Disable noisy loggers
|
|
for pkg_name in ['track.contexts', 'track.middleware', 'dd.dogapi']:
|
|
logging.getLogger(pkg_name).setLevel(logging.CRITICAL)
|
|
|
|
|
|
################################ EMAIL ########################################
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
|
|
################################# LMS INTEGRATION #############################
|
|
|
|
LMS_BASE = "localhost:8000"
|
|
FEATURES['PREVIEW_LMS_BASE'] = "preview." + LMS_BASE
|
|
|
|
########################### PIPELINE #################################
|
|
|
|
# Skip packaging and optimization in development
|
|
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',
|
|
]
|
|
|
|
############################ PYFS XBLOCKS SERVICE #############################
|
|
# Set configuration for Django pyfilesystem
|
|
|
|
DJFS = {
|
|
'type': 'osfs',
|
|
'directory_root': 'cms/static/djpyfs',
|
|
'url_root': '/static/djpyfs',
|
|
}
|
|
|
|
################################# CELERY ######################################
|
|
|
|
# By default don't use a worker, execute tasks as if they were local functions
|
|
CELERY_ALWAYS_EAGER = True
|
|
|
|
################################ DEBUG TOOLBAR ################################
|
|
INSTALLED_APPS += ('debug_toolbar', 'debug_toolbar_mongo')
|
|
MIDDLEWARE_CLASSES += ('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.panels.profiling.ProfilingPanel',
|
|
)
|
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
'SHOW_TOOLBAR_CALLBACK': 'cms.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.
|
|
|
|
|
|
# To see stacktraces for MongoDB queries, set this to True.
|
|
# Stacktraces slow down page loads drastically (for pages with lots of queries).
|
|
DEBUG_TOOLBAR_MONGO_STACKTRACES = False
|
|
|
|
|
|
################################ MILESTONES ################################
|
|
FEATURES['MILESTONES_APP'] = True
|
|
|
|
|
|
################################ ENTRANCE EXAMS ################################
|
|
FEATURES['ENTRANCE_EXAMS'] = True
|
|
|
|
################################ COURSE LICENSES ################################
|
|
FEATURES['LICENSING'] = True
|
|
# Needed to enable licensing on video modules
|
|
XBLOCK_SETTINGS = {
|
|
"VideoDescriptor": {
|
|
"licensing_enabled": True
|
|
}
|
|
}
|
|
|
|
################################ SEARCH INDEX ################################
|
|
FEATURES['ENABLE_COURSEWARE_INDEX'] = True
|
|
FEATURES['ENABLE_LIBRARY_INDEX'] = True
|
|
SEARCH_ENGINE = "search.elastic.ElasticSearchEngine"
|
|
|
|
########################## Certificates Web/HTML View #######################
|
|
FEATURES['CERTIFICATES_HTML_VIEW'] = True
|
|
|
|
################################# DJANGO-REQUIRE ###############################
|
|
|
|
# Whether to run django-require in debug mode.
|
|
REQUIRE_DEBUG = DEBUG
|
|
|
|
########################### OAUTH2 #################################
|
|
OAUTH_OIDC_ISSUER = 'http://127.0.0.1:8000/oauth2'
|
|
|
|
###############################################################################
|
|
# 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)
|
|
|
|
# Dummy secret key for dev
|
|
SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
|