Commit 1a5abdf6 by David Ormsbee

move more dev specific config (uploads, dummy caching) into dev.py

parent e253ea25
......@@ -133,12 +133,11 @@ MANAGERS = ADMINS
# Static content
STATIC_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
STATIC_ROOT = ENV_ROOT / "staticfiles" # FIXME: Should this and uploads be moved out of the repo?
STATIC_ROOT = ENV_ROOT / "staticfiles" # We don't run collectstatic -- this is to appease askbot checks
# FIXME: We should iterate through the courses we have, adding the static
# contents for each of them. (Right now we just use symlinks.)
STATICFILES_DIRS = (
# FIXME: Need to add entries for book, data/images, etc.
PROJECT_ROOT / "static",
ASKBOT_ROOT / "askbot" / "skins",
......@@ -150,16 +149,6 @@ STATICFILES_DIRS = (
# ("book", TEXTBOOK_DIR)
)
# Storage
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
MEDIA_ROOT = ENV_ROOT / "uploads"
MEDIA_URL = "/discussion/upfiles/"
FILE_UPLOAD_TEMP_DIR = ENV_ROOT / "uploads"
FILE_UPLOAD_HANDLERS = (
'django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler',
)
# Locale/Internationalization
TIME_ZONE = 'America/New_York' # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
LANGUAGE_CODE = 'en' # http://www.i18nguy.com/unicode/language-identifiers.html
......@@ -323,7 +312,7 @@ MIDDLEWARE_CLASSES = (
)
################################### APPS #######################################
def installed_apps(extras=()):
def installed_apps():
"""If you want to get a different set of INSTALLED_APPS out of this, you'll
have to set ASKBOT_ENABLED and COURSEWARE_ENABLED to True/False and call
this method. We can't just take these as params because other pieces of the
......@@ -360,7 +349,6 @@ def installed_apps(extras=()):
return tuple(STANDARD_APPS +
(COURSEWARE_APPS if COURSEWARE_ENABLED else []) +
(ASKBOT_APPS if ASKBOT_ENABLED else []) +
list(extras))
(ASKBOT_APPS if ASKBOT_ENABLED else []))
INSTALLED_APPS = installed_apps()
......@@ -9,7 +9,8 @@ sessions. Assumes structure:
"""
from common import *
CSRF_COOKIE_DOMAIN = 'localhost'
DEBUG = True
TEMPLATE_DEBUG = True
DATABASES = {
'default': {
......@@ -18,20 +19,16 @@ DATABASES = {
}
}
# Make this unique, and don't share it with anybody.
SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
DEBUG = True
TEMPLATE_DEBUG = True
# This is disabling ASKBOT, but not properly overwriting INSTALLED_APPS. ???
# It's because our ASKBOT_ENABLED here is actually shadowing the real one.
#
# ASKBOT_ENABLED = True
# MITX_FEATURES['SAMPLE'] = True # Switch to this system so we get around the shadowing
INSTALLED_APPS = installed_apps(extras=['debug_toolbar'])
MIDDLEWARE_CLASSES = ('debug_toolbar.middleware.DebugToolbarMiddleware',) + MIDDLEWARE_CLASSES
# Add the debug toolbar...
#INSTALLED_APPS += ('debug_toolbar',)
#MIDDLEWARE_CLASSES = ('debug_toolbar.middleware.DebugToolbarMiddleware',) + MIDDLEWARE_CLASSES
INTERNAL_IPS = ('127.0.0.1',)
DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.version.VersionDebugPanel',
......@@ -42,5 +39,36 @@ DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel',
# 'debug_toolbar.panels.profiling.ProfilingDebugPanel', # Lots of overhead
# 'debug_toolbar.panels.profiling.ProfilingDebugPanel', # Lots of overhead
)
# Storage for uploaded files (askbot file uploads at the moment)
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
MEDIA_ROOT = ENV_ROOT / "uploads"
MEDIA_URL = "/discussion/upfiles/"
FILE_UPLOAD_TEMP_DIR = ENV_ROOT / "uploads"
FILE_UPLOAD_HANDLERS = (
'django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler',
)
CACHES = {
# This is the cache used for most things. Askbot will not work without a
# 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'
},
# 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.
'general': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
'KEY_PREFIX': 'general',
}
}
# Dummy secret key for dev
SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
......@@ -22,6 +22,12 @@ CACHES = {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
'general': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
'KEY_PREFIX' : 'general',
'VERSION' : 3,
}
}
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment