Commit d92ce06c by David Ormsbee

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

parent 7e5b00bd
...@@ -133,12 +133,11 @@ MANAGERS = ADMINS ...@@ -133,12 +133,11 @@ MANAGERS = ADMINS
# Static content # Static content
STATIC_URL = '/static/' STATIC_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/' 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 # FIXME: We should iterate through the courses we have, adding the static
# contents for each of them. (Right now we just use symlinks.) # contents for each of them. (Right now we just use symlinks.)
STATICFILES_DIRS = ( STATICFILES_DIRS = (
# FIXME: Need to add entries for book, data/images, etc.
PROJECT_ROOT / "static", PROJECT_ROOT / "static",
ASKBOT_ROOT / "askbot" / "skins", ASKBOT_ROOT / "askbot" / "skins",
...@@ -150,16 +149,6 @@ STATICFILES_DIRS = ( ...@@ -150,16 +149,6 @@ STATICFILES_DIRS = (
# ("book", TEXTBOOK_DIR) # ("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 # Locale/Internationalization
TIME_ZONE = 'America/New_York' # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name 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 LANGUAGE_CODE = 'en' # http://www.i18nguy.com/unicode/language-identifiers.html
...@@ -323,7 +312,7 @@ MIDDLEWARE_CLASSES = ( ...@@ -323,7 +312,7 @@ MIDDLEWARE_CLASSES = (
) )
################################### APPS ####################################### ################################### APPS #######################################
def installed_apps(extras=()): def installed_apps():
"""If you want to get a different set of INSTALLED_APPS out of this, you'll """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 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 this method. We can't just take these as params because other pieces of the
...@@ -360,7 +349,6 @@ def installed_apps(extras=()): ...@@ -360,7 +349,6 @@ def installed_apps(extras=()):
return tuple(STANDARD_APPS + return tuple(STANDARD_APPS +
(COURSEWARE_APPS if COURSEWARE_ENABLED else []) + (COURSEWARE_APPS if COURSEWARE_ENABLED else []) +
(ASKBOT_APPS if ASKBOT_ENABLED else []) + (ASKBOT_APPS if ASKBOT_ENABLED else []))
list(extras))
INSTALLED_APPS = installed_apps() INSTALLED_APPS = installed_apps()
...@@ -9,7 +9,8 @@ sessions. Assumes structure: ...@@ -9,7 +9,8 @@ sessions. Assumes structure:
""" """
from common import * from common import *
CSRF_COOKIE_DOMAIN = 'localhost' DEBUG = True
TEMPLATE_DEBUG = True
DATABASES = { DATABASES = {
'default': { 'default': {
...@@ -18,20 +19,16 @@ DATABASES = { ...@@ -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. ??? # This is disabling ASKBOT, but not properly overwriting INSTALLED_APPS. ???
# It's because our ASKBOT_ENABLED here is actually shadowing the real one. # It's because our ASKBOT_ENABLED here is actually shadowing the real one.
# #
# ASKBOT_ENABLED = True # ASKBOT_ENABLED = True
# MITX_FEATURES['SAMPLE'] = True # Switch to this system so we get around the shadowing # MITX_FEATURES['SAMPLE'] = True # Switch to this system so we get around the shadowing
INSTALLED_APPS = installed_apps(extras=['debug_toolbar']) # Add the debug toolbar...
MIDDLEWARE_CLASSES = ('debug_toolbar.middleware.DebugToolbarMiddleware',) + MIDDLEWARE_CLASSES #INSTALLED_APPS += ('debug_toolbar',)
#MIDDLEWARE_CLASSES = ('debug_toolbar.middleware.DebugToolbarMiddleware',) + MIDDLEWARE_CLASSES
INTERNAL_IPS = ('127.0.0.1',)
DEBUG_TOOLBAR_PANELS = ( DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.version.VersionDebugPanel', 'debug_toolbar.panels.version.VersionDebugPanel',
...@@ -42,5 +39,36 @@ DEBUG_TOOLBAR_PANELS = ( ...@@ -42,5 +39,36 @@ DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.sql.SQLDebugPanel', 'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel', 'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel', '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 = { ...@@ -22,6 +22,12 @@ CACHES = {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211', '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' 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