6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-14 06:58:21 +00:00

Factor out common logic for cms/{production/development}.py

This commit is contained in:
Silvio Tomatis 2019-04-24 15:47:26 +02:00 committed by Régis Behmo
parent cb9d342196
commit ce1bb05d8e
3 changed files with 28 additions and 44 deletions

View File

@ -0,0 +1,24 @@
# Load module store settings from config files
update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
# Set uploaded media file path
MEDIA_ROOT = "/openedx/data/uploads/"
# Video settings
VIDEO_IMAGE_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
VIDEO_TRANSCRIPTS_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
# Change syslog-based loggers which don't work inside docker containers
LOGGING['handlers']['local'] = {'class': 'logging.NullHandler'}
LOGGING['handlers']['tracking'] = {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'standard',
}
LOCALE_PATHS.append('/openedx/locale')
# Create folders if necessary
for folder in [LOG_DIR, MEDIA_ROOT, STATIC_ROOT_BASE]:
if not os.path.exists(folder):
os.makedirs(folder)

View File

@ -1,30 +1,9 @@
import os import os
from cms.envs.devstack import * from cms.envs.devstack import *
# Load module store settings from config files
update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
# Set uploaded media file path # Execute the contents of common.py in this context
MEDIA_ROOT = "/openedx/data/uploads/" execfile(os.path.join(os.path.dirname(__file__), 'common.py'), globals())
# Video settings
VIDEO_IMAGE_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
VIDEO_TRANSCRIPTS_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
# Change syslog-based loggers which don't work inside docker containers
LOGGING['handlers']['local'] = {'class': 'logging.NullHandler'}
LOGGING['handlers']['tracking'] = {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'standard',
}
LOCALE_PATHS.append('/openedx/locale')
# Setup correct webpack configuration file for development # Setup correct webpack configuration file for development
WEBPACK_CONFIG_PATH = 'webpack.dev.config.js' WEBPACK_CONFIG_PATH = 'webpack.dev.config.js'
# Create folders if necessary
for folder in [LOG_DIR, MEDIA_ROOT, STATIC_ROOT_BASE]:
if not os.path.exists(folder):
os.makedirs(folder)

View File

@ -1,21 +1,9 @@
import os import os
from cms.envs.production import * from cms.envs.production import *
update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
MEDIA_ROOT = "/openedx/data/uploads/" # Execute the contents of common.py in this context
execfile(os.path.join(os.path.dirname(__file__), 'common.py'), globals())
# Video settings
VIDEO_IMAGE_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
VIDEO_TRANSCRIPTS_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
# Change syslog-based loggers which don't work inside docker containers
LOGGING['handlers']['local'] = {'class': 'logging.NullHandler'}
LOGGING['handlers']['tracking'] = {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'standard',
}
ALLOWED_HOSTS = [ ALLOWED_HOSTS = [
ENV_TOKENS.get('CMS_BASE'), ENV_TOKENS.get('CMS_BASE'),
@ -27,10 +15,3 @@ ALLOWED_HOSTS = [
DEFAULT_FROM_EMAIL = ENV_TOKENS['CONTACT_EMAIL'] DEFAULT_FROM_EMAIL = ENV_TOKENS['CONTACT_EMAIL']
DEFAULT_FEEDBACK_EMAIL = ENV_TOKENS['CONTACT_EMAIL'] DEFAULT_FEEDBACK_EMAIL = ENV_TOKENS['CONTACT_EMAIL']
SERVER_EMAIL = ENV_TOKENS['CONTACT_EMAIL'] SERVER_EMAIL = ENV_TOKENS['CONTACT_EMAIL']
LOCALE_PATHS.append('/openedx/locale')
# Create folders if necessary
for folder in [LOG_DIR, MEDIA_ROOT, STATIC_ROOT_BASE]:
if not os.path.exists(folder):
os.makedirs(folder)