dev.py 6.41 KB
Newer Older
1 2 3
"""
This config file runs the simplest dev environment"""

4 5 6 7
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614

8
from .common import *
9
from logsettings import get_logger_config
10 11 12

DEBUG = True
TEMPLATE_DEBUG = DEBUG
Victor Shnayder committed
13 14 15
LOGGING = get_logger_config(ENV_ROOT / "log",
                            logging_env="dev",
                            tracking_filename="tracking.log",
Calen Pennington committed
16
                            dev_env=True,
Victor Shnayder committed
17 18
                            debug=True)

19
modulestore_options = {
20
    'default_class': 'xmodule.raw_module.RawDescriptor',
21
    'fs_root': GITHUB_REPO_ROOT,
David Baumgold committed
22
    'render_template': 'edxmako.shortcuts.render_to_string',
23
}
24

25
MODULESTORE = {
26
    'default': {
27
        'ENGINE': 'xmodule.modulestore.draft.DraftModuleStore',
28
        'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
29 30 31
        'OPTIONS': modulestore_options
    },
    'direct': {
32
        'ENGINE': 'xmodule.modulestore.mongo.MongoModuleStore',
33
        'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
34
        'OPTIONS': modulestore_options
35 36 37
    },
    'split': {
        'ENGINE': 'xmodule.modulestore.split_mongo.SplitMongoModuleStore',
38
        'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
39
        'OPTIONS': modulestore_options
40
    }
41 42
}

43

44 45 46 47
# cdodge: This is the specifier for the MongoDB (using GridFS) backed static content store
# This is for static content for courseware, not system static content (e.g. javascript, css, edX branding, etc)
CONTENTSTORE = {
    'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore',
48
    'DOC_STORE_CONFIG': {
49
        'host': 'localhost',
Calen Pennington committed
50
        'db': 'xcontent',
51 52 53 54 55 56
    },
    # allow for additional options that can be keyed on a name, e.g. 'trashcan'
    'ADDITIONAL_OPTIONS': {
        'trashcan': {
            'bucket': 'trash_fs'
        }
57 58 59
    }
}

60 61 62
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
63
        'NAME': ENV_ROOT / "db" / "edx.db",
64 65 66
    }
}

67
LMS_BASE = "localhost:8000"
68
FEATURES['PREVIEW_LMS_BASE'] = "localhost:8000"
69

70 71
REPOS = {
    'edx4edx': {
72
        'branch': 'master',
73 74
        'origin': 'git@github.com:MITx/edx4edx.git',
    },
75 76
    'content-mit-6002x': {
        'branch': 'master',
Don Mitchell committed
77
        # 'origin': 'git@github.com:MITx/6002x-fall-2012.git',
78
        'origin': 'git@github.com:MITx/content-mit-6002x.git',
79 80
    },
    '6.00x': {
81
        'branch': 'master',
82 83 84
        'origin': 'git@github.com:MITx/6.00x.git',
    },
    '7.00x': {
85
        'branch': 'master',
86 87 88
        'origin': 'git@github.com:MITx/7.00x.git',
    },
    '3.091x': {
89
        'branch': 'master',
90 91
        'origin': 'git@github.com:MITx/3.091x.git',
    },
92 93
}

94
CACHES = {
95
    # This is the cache used for most things. Askbot will not work without a
96 97 98 99
    # functioning cache -- it relies on caching to load its settings in places.
    # In staging/prod envs, the sessions also live here.
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
100
        'LOCATION': 'edx_loc_mem_cache',
101 102 103 104 105 106 107 108 109 110 111 112
        'KEY_FUNCTION': 'util.memcache.safe_key',
    },

    # The general cache is what you get if you use our util.cache. It's used for
    # things like caching the course.xml file for different A/B test groups.
    # We set it to be a DummyCache to force reloading of course.xml in dev.
    # In staging environments, we would grab VERSION from data uploaded by the
    # push process.
    'general': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
        'KEY_PREFIX': 'general',
        'VERSION': 4,
113
        'KEY_FUNCTION': 'util.memcache.safe_key',
114 115 116 117 118 119 120
    },

    'mongo_metadata_inheritance': {
        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
        'LOCATION': '/var/tmp/mongo_metadata_inheritance',
        'TIMEOUT': 300,
        'KEY_FUNCTION': 'util.memcache.safe_key',
121 122 123 124 125 126
    },
    'loc_cache': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': 'edx_location_mem_cache',
    },

127
}
128 129 130

# Make the keyedcache startup warnings go away
CACHE_TIMEOUT = 0
131 132 133

# Dummy secret key for dev
SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
134

135 136 137 138
################################ PIPELINE #################################

PIPELINE_SASS_ARGUMENTS = '--debug-info --require {proj_dir}/static/sass/bourbon/lib/bourbon.rb'.format(proj_dir=PROJECT_ROOT)

139 140 141 142 143
################################# CELERY ######################################

# By default don't use a worker, execute tasks as if they were local functions
CELERY_ALWAYS_EAGER = True

144 145
################################ DEBUG TOOLBAR #################################
INSTALLED_APPS += ('debug_toolbar', 'debug_toolbar_mongo')
Chris Dodge committed
146
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
147 148 149
INTERNAL_IPS = ('127.0.0.1',)

DEBUG_TOOLBAR_PANELS = (
150 151 152 153 154 155 156 157
    'debug_toolbar.panels.version.VersionDebugPanel',
    'debug_toolbar.panels.timer.TimerDebugPanel',
    'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
    'debug_toolbar.panels.headers.HeaderDebugPanel',
    'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
    'debug_toolbar.panels.sql.SQLDebugPanel',
    'debug_toolbar.panels.signals.SignalDebugPanel',
    'debug_toolbar.panels.logger.LoggingPanel',
158 159 160 161 162 163

    #  Enabling the profiler has a weird bug as of django-debug-toolbar==0.9.4 and
    #  Django=1.3.1/1.4 where requests to views get duplicated (your method gets
    #  hit twice). So you can uncomment when you need to diagnose performance
    #  problems, but you shouldn't leave it on.
    #  'debug_toolbar.panels.profiling.ProfilingDebugPanel',
164
)
165 166 167 168 169 170 171

DEBUG_TOOLBAR_CONFIG = {
    'INTERCEPT_REDIRECTS': False
}

# To see stacktraces for MongoDB queries, set this to True.
# Stacktraces slow down page loads drastically (for pages with lots of queries).
172
DEBUG_TOOLBAR_MONGO_STACKTRACES = False
173 174

# disable NPS survey in dev mode
175
FEATURES['STUDIO_NPS_SURVEY'] = False
176

177
# Enable URL that shows information about the status of variuous services
178
FEATURES['ENABLE_SERVICE_STATUS'] = True
179

180 181
############################# SEGMENT-IO ##################################

182 183
# If there's an environment variable set, grab it and turn on Segment.io
# Note that this is the Studio key. There is a separate key for the LMS.
pdehaye committed
184
import os
185 186
SEGMENT_IO_KEY = os.environ.get('SEGMENT_IO_KEY')
if SEGMENT_IO_KEY:
187
    FEATURES['SEGMENT_IO'] = True
188 189 190 191 192


#####################################################################
# Lastly, see if the developer has any local overrides.
try:
193
    from .private import *  # pylint: disable=F0401
194 195
except ImportError:
    pass