dev.py 6.23 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 20 21 22 23 24
modulestore_options = {
    'default_class': 'xmodule.raw_module.RawDescriptor',
    'host': 'localhost',
    'db': 'xmodule',
    'collection': 'modulestore',
    'fs_root': GITHUB_REPO_ROOT,
25
    'render_template': 'mitxmako.shortcuts.render_to_string',
26 27
}

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

43

44 45 46 47 48 49
# 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',
    'OPTIONS': {
        '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" / "mitx.db",
64 65 66
    }
}

67
LMS_BASE = "localhost:8000"
68
MITX_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 100 101 102 103 104 105 106 107 108 109 110 111 112
    # 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',
        'LOCATION': 'mitx_loc_mem_cache',
        '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

# Make the keyedcache startup warnings go away
CACHE_TIMEOUT = 0
126 127 128

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

130 131 132 133
################################ PIPELINE #################################

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

134 135 136 137 138
################################# CELERY ######################################

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

139 140
################################ DEBUG TOOLBAR #################################
INSTALLED_APPS += ('debug_toolbar', 'debug_toolbar_mongo')
Chris Dodge committed
141
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
INTERNAL_IPS = ('127.0.0.1',)

DEBUG_TOOLBAR_PANELS = (
    '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',

    #  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',
159
)
160 161 162 163 164 165 166

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).
167
DEBUG_TOOLBAR_MONGO_STACKTRACES = False
168 169 170

# disable NPS survey in dev mode
MITX_FEATURES['STUDIO_NPS_SURVEY'] = False
171

172 173 174
# Enable URL that shows information about the status of variuous services
MITX_FEATURES['ENABLE_SERVICE_STATUS'] = True

175 176
############################# SEGMENT-IO ##################################

177 178
# 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
179
import os
180 181 182
SEGMENT_IO_KEY = os.environ.get('SEGMENT_IO_KEY')
if SEGMENT_IO_KEY:
    MITX_FEATURES['SEGMENT_IO'] = True
183 184 185 186 187


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