Beginning to merge new settings file
--HG-- branch : pmitros-dormsbee-settings2 rename : settings_new_askbot.py => settings.py
This commit is contained in:
@@ -175,7 +175,7 @@ class Module(XModule):
|
||||
self.attempts=state['attempts']
|
||||
|
||||
self.filename=content_parser.item(dom2.xpath('/problem/@filename'))
|
||||
filename=settings.DATA_DIR+"problems/"+self.filename+".xml"
|
||||
filename=settings.DATA_DIR+"/problems/"+self.filename+".xml"
|
||||
self.name=content_parser.item(dom2.xpath('/problem/@name'))
|
||||
self.lcp=LoncapaProblem(filename, self.item_id, state)
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
settings_new_askbot.py
|
||||
392
settings.py
Normal file
392
settings.py
Normal file
@@ -0,0 +1,392 @@
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import djcelery
|
||||
|
||||
# Configuration option for when we want to grab server error pages
|
||||
STATIC_GRAB = False
|
||||
DEV_CONTENT = True
|
||||
|
||||
LIB_URL = '/static/lib/'
|
||||
LIB_URL = 'https://mitxstatic.s3.amazonaws.com/js/'
|
||||
BOOK_URL = '/static/book/'
|
||||
BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/'
|
||||
|
||||
# Feature Flags. These should be set to false until they are ready to deploy, and then eventually flag mechanisms removed
|
||||
GENERATE_PROFILE_SCORES = False # If this is true, random scores will be generated for the purpose of debugging the profile graphs
|
||||
|
||||
# Our parent dir (mitx_all) is the BASE_DIR
|
||||
BASE_DIR = os.path.abspath(os.path.join(__file__, "..", ".."))
|
||||
|
||||
COURSEWARE_ENABLED = True
|
||||
ASKBOT_ENABLED = True
|
||||
CSRF_COOKIE_DOMAIN = '127.0.0.1'
|
||||
|
||||
# Defaults to be overridden
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
SITE_NAME = "localhost:8000"
|
||||
|
||||
DEFAULT_FROM_EMAIL = 'registration@mitx.mit.edu'
|
||||
DEFAULT_FEEDBACK_EMAIL = 'feedback@mitx.mit.edu'
|
||||
|
||||
GENERATE_RANDOM_USER_CREDENTIALS = False
|
||||
|
||||
WIKI_REQUIRE_LOGIN_EDIT = True
|
||||
WIKI_REQUIRE_LOGIN_VIEW = True
|
||||
|
||||
PERFSTATS = False
|
||||
|
||||
HTTPS = 'on'
|
||||
|
||||
MEDIA_URL = ''
|
||||
MEDIA_ROOT = ''
|
||||
|
||||
# S3BotoStorage insists on a timeout for uploaded assets. We should make it
|
||||
# permanent instead, but rather than trying to figure out exactly where that
|
||||
# setting is, I'm just bumping the expiration time to something absurd (100
|
||||
# years). This is only used if DEFAULT_FILE_STORAGE is overriden to use S3
|
||||
# in the global settings.py
|
||||
AWS_QUERYSTRING_EXPIRE = 10 * 365 * 24 * 60 * 60 # 10 years
|
||||
|
||||
# Needed for Askbot
|
||||
# Deployed machines: Move to S3
|
||||
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
('MITx Admins', 'admin@mitx.mit.edu'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
TIME_ZONE = 'America/New_York'
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'en'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = True
|
||||
|
||||
# If you set this to False, Django will not format dates, numbers and
|
||||
# calendars according to the current locale
|
||||
USE_L10N = True
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# URL prefix for admin static files -- CSS, JavaScript and images.
|
||||
# Make sure to use a trailing slash.
|
||||
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
||||
ADMIN_MEDIA_PREFIX = '/static/admin/'
|
||||
|
||||
# List of finder classes that know how to find static files in
|
||||
# various locations.
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
)
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'track.middleware.TrackMiddleware',
|
||||
'mitxmako.middleware.MakoMiddleware',
|
||||
#'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'mitx.urls'
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'courseware',
|
||||
'student',
|
||||
'django.contrib.humanize',
|
||||
'static_template_view',
|
||||
'staticbook',
|
||||
'simplewiki',
|
||||
'track',
|
||||
'circuit',
|
||||
'perfstats',
|
||||
'util',
|
||||
# Uncomment the next line to enable the admin:
|
||||
# 'django.contrib.admin',
|
||||
# Uncomment the next line to enable admin documentation:
|
||||
# 'django.contrib.admindocs',
|
||||
)
|
||||
|
||||
#TRACK_DIR = None
|
||||
DEBUG_TRACK_LOG = False
|
||||
# Maximum length of a tracking string. We don't want e.g. a file upload in our log
|
||||
TRACK_MAX_EVENT = 1000
|
||||
# Maximum length of log file before starting a new one.
|
||||
MAXLOG = 500
|
||||
|
||||
LOG_DIR = "/tmp/"
|
||||
MAKO_MODULE_DIR = None
|
||||
|
||||
# Make sure we execute correctly regardless of where we're called from
|
||||
execfile(os.path.join(BASE_DIR, "settings.py"))
|
||||
|
||||
if MAKO_MODULE_DIR == None:
|
||||
MAKO_MODULE_DIR = tempfile.mkdtemp('mako')
|
||||
|
||||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
# the site admins on every HTTP 500 error.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
|
||||
pid = os.getpid()
|
||||
hostname = platform.node().split(".")[0]
|
||||
SYSLOG_ADDRESS = ('syslog.m.i4x.org', 514)
|
||||
|
||||
handlers = ['console']
|
||||
if not DEBUG:
|
||||
handlers.append('syslogger')
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': True,
|
||||
'formatters' : {
|
||||
'standard' : {
|
||||
'format' : '%(asctime)s %(levelname)s %(process)d [%(name)s] %(filename)s:%(lineno)d - %(message)s',
|
||||
},
|
||||
'syslog_format' : {
|
||||
'format' : '[%(name)s] %(levelname)s [' + hostname + ' %(process)d] [%(filename)s:%(lineno)d] - %(message)s',
|
||||
},
|
||||
'raw' : {
|
||||
'format' : '%(message)s',
|
||||
}
|
||||
},
|
||||
'handlers' : {
|
||||
'console' : {
|
||||
'level' : 'DEBUG' if DEBUG else 'INFO',
|
||||
'class' : 'logging.StreamHandler',
|
||||
'formatter' : 'standard',
|
||||
'stream' : sys.stdout,
|
||||
},
|
||||
'console_err' : {
|
||||
'level' : 'ERROR',
|
||||
'class' : 'logging.StreamHandler',
|
||||
'formatter' : 'standard',
|
||||
'stream' : sys.stderr,
|
||||
},
|
||||
'syslogger' : {
|
||||
'level' : 'INFO',
|
||||
'class' : 'logging.handlers.SysLogHandler',
|
||||
'address' : SYSLOG_ADDRESS,
|
||||
'formatter' : 'syslog_format',
|
||||
},
|
||||
'mail_admins' : {
|
||||
'level': 'ERROR',
|
||||
'class': 'django.utils.log.AdminEmailHandler',
|
||||
},
|
||||
},
|
||||
'loggers' : {
|
||||
'django' : {
|
||||
'handlers' : handlers + ['mail_admins'],
|
||||
'propagate' : True,
|
||||
'level' : 'INFO'
|
||||
},
|
||||
'tracking' : {
|
||||
'handlers' : [] if DEBUG else ['syslogger'], # handlers,
|
||||
'level' : 'DEBUG',
|
||||
'propagate' : False,
|
||||
},
|
||||
'root' : {
|
||||
'handlers' : handlers,
|
||||
'level' : 'DEBUG',
|
||||
'propagate' : False
|
||||
},
|
||||
'mitx' : {
|
||||
'handlers' : handlers,
|
||||
'level' : 'DEBUG',
|
||||
'propagate' : False
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if PERFSTATS :
|
||||
MIDDLEWARE_CLASSES = ( 'perfstats.middleware.ProfileMiddleware',) + MIDDLEWARE_CLASSES
|
||||
|
||||
if 'TRACK_DIR' not in locals():
|
||||
TRACK_DIR = BASE_DIR+'/track_dir/'
|
||||
if 'STATIC_ROOT' not in locals():
|
||||
STATIC_ROOT = BASE_DIR+'/staticroot/'
|
||||
if 'DATA_DIR' not in locals():
|
||||
DATA_DIR = BASE_DIR+'/data/'
|
||||
if 'TEXTBOOK_DIR' not in locals():
|
||||
TEXTBOOK_DIR = BASE_DIR+'/textbook/'
|
||||
|
||||
if 'TEMPLATE_DIRS' not in locals():
|
||||
TEMPLATE_DIRS = (
|
||||
BASE_DIR+'/templates/',
|
||||
DATA_DIR+'/templates',
|
||||
TEXTBOOK_DIR,
|
||||
)
|
||||
|
||||
if 'STATICFILES_DIRS' not in locals():
|
||||
STATICFILES_DIRS = (
|
||||
BASE_DIR+'/3rdParty/static',
|
||||
BASE_DIR+'/static',
|
||||
)
|
||||
|
||||
|
||||
if 'ASKBOT_EXTRA_SKINS_DIR' not in locals():
|
||||
ASKBOT_EXTRA_SKINS_DIR = BASE_DIR+'/askbot-devel/askbot/skins'
|
||||
if 'ASKBOT_DIR' not in locals():
|
||||
ASKBOT_DIR = BASE_DIR+'/askbot-devel'
|
||||
|
||||
sys.path.append(ASKBOT_DIR)
|
||||
import askbot
|
||||
import site
|
||||
|
||||
STATICFILES_DIRS = STATICFILES_DIRS + ( ASKBOT_DIR+'/askbot/skins',)
|
||||
|
||||
ASKBOT_ROOT = os.path.dirname(askbot.__file__)
|
||||
|
||||
# Needed for Askbot
|
||||
# Deployed machines: Move to S3
|
||||
if MEDIA_ROOT == '':
|
||||
MEDIA_ROOT = ASKBOT_DIR+'/askbot/upfiles'
|
||||
if MEDIA_URL == '':
|
||||
MEDIA_URL = '/discussion/upfiles/'
|
||||
|
||||
site.addsitedir(os.path.join(os.path.dirname(askbot.__file__), 'deps'))
|
||||
TEMPLATE_LOADERS = TEMPLATE_LOADERS + ('askbot.skins.loaders.filesystem_load_template_source',)
|
||||
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
|
||||
'util.middleware.ExceptionLoggingMiddleware',
|
||||
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
|
||||
'askbot.middleware.forum_mode.ForumModeMiddleware',
|
||||
'askbot.middleware.cancel.CancelActionMiddleware',
|
||||
'django.middleware.transaction.TransactionMiddleware',
|
||||
#'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
'askbot.middleware.view_log.ViewLogMiddleware',
|
||||
'askbot.middleware.spaceless.SpacelessMiddleware',
|
||||
# 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
|
||||
)
|
||||
|
||||
FILE_UPLOAD_TEMP_DIR = os.path.join(os.path.dirname(__file__), 'tmp').replace('\\','/')
|
||||
FILE_UPLOAD_HANDLERS = (
|
||||
'django.core.files.uploadhandler.MemoryFileUploadHandler',
|
||||
'django.core.files.uploadhandler.TemporaryFileUploadHandler',
|
||||
)
|
||||
ASKBOT_ALLOWED_UPLOAD_FILE_TYPES = ('.jpg', '.jpeg', '.gif', '.bmp', '.png', '.tiff')
|
||||
ASKBOT_MAX_UPLOAD_FILE_SIZE = 1024 * 1024 #result in bytes
|
||||
# ASKBOT_FILE_UPLOAD_DIR = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
|
||||
|
||||
PROJECT_ROOT = os.path.dirname(__file__)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.core.context_processors.request',
|
||||
'askbot.context.application_settings',
|
||||
#'django.core.context_processors.i18n',
|
||||
'askbot.user_messages.context_processors.user_messages',#must be before auth
|
||||
'django.core.context_processors.auth', #this is required for admin
|
||||
'django.core.context_processors.csrf', #necessary for csrf protection
|
||||
)
|
||||
|
||||
INSTALLED_APPS = INSTALLED_APPS + (
|
||||
'django.contrib.sitemaps',
|
||||
'django.contrib.admin',
|
||||
'south',
|
||||
'askbot.deps.livesettings',
|
||||
'askbot',
|
||||
#'keyedcache', # TODO: Main askbot tree has this installed, but we get intermittent errors if we include it.
|
||||
'robots',
|
||||
'django_countries',
|
||||
'djcelery',
|
||||
'djkombu',
|
||||
'followit',
|
||||
)
|
||||
|
||||
# askbot livesettings
|
||||
LIVESETTINGS_OPTIONS = {
|
||||
1: {
|
||||
'SETTINGS' : {
|
||||
'FORUM_DATA_RULES' : {
|
||||
'MIN_TITLE_LENGTH' : 1,
|
||||
'MIN_QUESTION_BODY_LENGTH' : 1,
|
||||
'MIN_ANSWER_BODY_LENGTH' : 1,
|
||||
|
||||
# 'ENABLE_VIDEO_EMBEDDING' : True,
|
||||
#
|
||||
# Enabling video requires forked version of markdown
|
||||
# pip uninstall markdown2
|
||||
# pip install -e git+git://github.com/andryuha/python-markdown2.git#egg=markdown2
|
||||
},
|
||||
'MIN_REP' : {
|
||||
'MIN_REP_TO_VOTE_UP' : 1,
|
||||
'MIN_REP_TO_VOTE_DOWN' : 1,
|
||||
'MIN_REP_TO_ANSWER_OWN_QUESTION' : 1,
|
||||
'MIN_REP_TO_ACCEPT_OWN_ANSWER' : 1,
|
||||
'MIN_REP_TO_FLAG_OFFENSIVE' : 1,
|
||||
'MIN_REP_TO_LEAVE_COMMENTS' : 1,
|
||||
'MIN_REP_TO_CLOSE_OWN_QUESTIONS' : 1,
|
||||
'MIN_REP_TO_RETAG_OTHERS_QUESTIONS' : 1,
|
||||
'MIN_REP_TO_REOPEN_OWN_QUESTIONS' : 1,
|
||||
'MIN_REP_TO_EDIT_WIKI' : 1,
|
||||
'MIN_REP_TO_CLOSE_OTHERS_QUESTIONS' : 100,
|
||||
'MIN_REP_TO_UPLOAD_FILES' : 1,
|
||||
},
|
||||
'SOCIAL_SHARING' : {
|
||||
'ENABLE_SHARING_TWITTER' : False,
|
||||
'ENABLE_SHARING_FACEBOOK' : False,
|
||||
'ENABLE_SHARING_LINKEDIN' : False,
|
||||
'ENABLE_SHARING_IDENTICA' : False,
|
||||
'ENABLE_SHARING_GOOGLE' : False,
|
||||
},
|
||||
'USER_SETTINGS' : {
|
||||
'EDITABLE_SCREEN_NAME' : False,
|
||||
'EDITABLE_EMAIL' : False,
|
||||
'ALLOW_ADD_REMOVE_LOGIN_METHODS' : False,
|
||||
'ENABLE_GRAVATAR' : False,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
|
||||
ASKBOT_URL = 'discussion/'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGIN_URL = '/'
|
||||
|
||||
# ASKBOT_UPLOADED_FILES_URL = '%s%s' % (ASKBOT_URL, 'upfiles/')
|
||||
ALLOW_UNICODE_SLUGS = False
|
||||
ASKBOT_USE_STACKEXCHANGE_URLS = False #mimic url scheme of stackexchange
|
||||
ASKBOT_CSS_DEVEL = True
|
||||
|
||||
# Celery Settings
|
||||
BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"
|
||||
CELERY_ALWAYS_EAGER = True
|
||||
|
||||
djcelery.setup_loader()
|
||||
|
||||
4
settings2/README.txt
Normal file
4
settings2/README.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Transitional for moving to new settings scheme.
|
||||
|
||||
To use:
|
||||
django-admin runserver --settings=settings2.dev --pythonpath="."
|
||||
0
settings2/__init__.py
Normal file
0
settings2/__init__.py
Normal file
18
settings2/aws.py
Normal file
18
settings2/aws.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from common import *
|
||||
|
||||
EMAIL_BACKEND = 'django_ses.SESBackend'
|
||||
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
|
||||
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
|
||||
|
||||
CSRF_COOKIE_DOMAIN = '.mitx.mit.edu'
|
||||
LIB_URL = 'https://mitxstatic.s3.amazonaws.com/js/'
|
||||
BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/'
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = False
|
||||
@@ -1,172 +1,172 @@
|
||||
"""
|
||||
This is the common settings file, intended to set sane defaults. If you have a
|
||||
piece of configuration that's dependent on a set of feature flags being set,
|
||||
then create a function that returns the calculated value based on the value of
|
||||
MITX_FEATURES[...]. That classes that extend this one can change the feature
|
||||
configuration in an environment specific config file and re-calculate those
|
||||
values.
|
||||
|
||||
We should make a method that calls all these config methods so that you just
|
||||
make one call at the end of your site-specific dev file and it reset all the
|
||||
dependent variables (like INSTALLED_APPS) for you.
|
||||
|
||||
TODO:
|
||||
1. Right now our treatment of static content in general and in particular
|
||||
course-specific static content is haphazard.
|
||||
2. We should have a more disciplined approach to feature flagging, even if it
|
||||
just means that we stick them in a dict called MITX_FEATURES.
|
||||
3. We need to handle configuration for multiple courses. This could be as
|
||||
multiple sites, but we do need a way to map their data assets.
|
||||
"""
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from path import path
|
||||
import djcelery
|
||||
|
||||
################################### FEATURES ###################################
|
||||
COURSEWARE_ENABLED = True
|
||||
ASKBOT_ENABLED = True
|
||||
GENERATE_RANDOM_USER_CREDENTIALS = False
|
||||
PERFSTATS = False
|
||||
|
||||
# Features
|
||||
MITX_FEATURES = {
|
||||
'SAMPLE' : False
|
||||
}
|
||||
|
||||
############################# SET PATH INFORMATION #############################
|
||||
PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /mitxweb
|
||||
ENV_ROOT = PROJECT_ROOT.dirname() # virtualenv dir /mitxweb is in
|
||||
#ASKBOT_ROOT = ENV_ROOT / "3rdparty" / "askbot-devel"
|
||||
ASKBOT_ROOT = ENV_ROOT / "askbot-devel"
|
||||
#COURSES_ROOT = ENV_ROOT / "courses"
|
||||
COURSES_ROOT = ENV_ROOT / "data"
|
||||
|
||||
# FIXME: code shouldn't expect trailing "/"
|
||||
# FIXME: To support multiple courses, we should walk the courses dir at startup
|
||||
#DATA_DIR = COURSES_ROOT / "6002x" / ""
|
||||
DATA_DIR = COURSES_ROOT
|
||||
|
||||
#print DATA_DIR, COURSES_ROOT, ASKBOT_ROOT, ENV_ROOT, PROJECT_ROOT
|
||||
|
||||
sys.path.append(ENV_ROOT)
|
||||
sys.path.append(ASKBOT_ROOT)
|
||||
sys.path.append(ASKBOT_ROOT / "askbot" / "deps")
|
||||
sys.path.append(PROJECT_ROOT / 'djangoapps')
|
||||
sys.path.append(PROJECT_ROOT / 'lib')
|
||||
|
||||
################################## MITXWEB #####################################
|
||||
# This is where we stick our compiled template files
|
||||
MAKO_MODULE_DIR = tempfile.mkdtemp('mako')
|
||||
TEXTBOOK_DIR = ENV_ROOT / "books" / "circuits_agarwal_lang"
|
||||
|
||||
# FIXME ???????? --
|
||||
# We should have separate S3 staged URLs in case we need to make changes to
|
||||
# these assets and test them.
|
||||
LIB_URL = '/static/lib/'
|
||||
# LIB_URL = 'https://mitxstatic.s3.amazonaws.com/js/' # For AWS deploys
|
||||
|
||||
# Dev machines shouldn't need the book
|
||||
# BOOK_URL = '/static/book/'
|
||||
BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/' # For AWS deploys
|
||||
|
||||
# FIXME ??????? What are these exactly?
|
||||
# Configuration option for when we want to grab server error pages
|
||||
STATIC_GRAB = False
|
||||
DEV_CONTENT = True
|
||||
|
||||
LIB_URL = '/static/lib/'
|
||||
LIB_URL = 'https://mitxstatic.s3.amazonaws.com/js/'
|
||||
BOOK_URL = '/static/book/'
|
||||
BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/'
|
||||
# FIXME: Should we be doing this truncation?
|
||||
TRACK_MAX_EVENT = 1000
|
||||
|
||||
# Feature Flags. These should be set to false until they are ready to deploy, and then eventually flag mechanisms removed
|
||||
GENERATE_PROFILE_SCORES = False # If this is true, random scores will be generated for the purpose of debugging the profile graphs
|
||||
GENERATE_PROFILE_SCORES = False
|
||||
|
||||
# Our parent dir (mitx_all) is the BASE_DIR
|
||||
BASE_DIR = os.path.abspath(os.path.join(__file__, "..", ".."))
|
||||
############################### DJANGO BUILT-INS ###############################
|
||||
# Change DEBUG/TEMPLATE_DEBUG in your environment settings files, not here
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = False
|
||||
|
||||
COURSEWARE_ENABLED = True
|
||||
ASKBOT_ENABLED = True
|
||||
CSRF_COOKIE_DOMAIN = '127.0.0.1'
|
||||
|
||||
# Defaults to be overridden
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
# Site info
|
||||
SITE_ID = 1
|
||||
SITE_NAME = "localhost:8000"
|
||||
CSRF_COOKIE_DOMAIN = '127.0.0.1'
|
||||
HTTPS = 'on'
|
||||
ROOT_URLCONF = 'mitxweb.urls'
|
||||
|
||||
# Email
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
DEFAULT_FROM_EMAIL = 'registration@mitx.mit.edu'
|
||||
DEFAULT_FEEDBACK_EMAIL = 'feedback@mitx.mit.edu'
|
||||
|
||||
GENERATE_RANDOM_USER_CREDENTIALS = False
|
||||
|
||||
WIKI_REQUIRE_LOGIN_EDIT = True
|
||||
WIKI_REQUIRE_LOGIN_VIEW = True
|
||||
|
||||
PERFSTATS = False
|
||||
|
||||
HTTPS = 'on'
|
||||
|
||||
MEDIA_URL = ''
|
||||
MEDIA_ROOT = ''
|
||||
|
||||
# S3BotoStorage insists on a timeout for uploaded assets. We should make it
|
||||
# permanent instead, but rather than trying to figure out exactly where that
|
||||
# setting is, I'm just bumping the expiration time to something absurd (100
|
||||
# years). This is only used if DEFAULT_FILE_STORAGE is overriden to use S3
|
||||
# in the global settings.py
|
||||
AWS_QUERYSTRING_EXPIRE = 10 * 365 * 24 * 60 * 60 # 10 years
|
||||
|
||||
# Needed for Askbot
|
||||
# Deployed machines: Move to S3
|
||||
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
('MITx Admins', 'admin@mitx.mit.edu'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
TIME_ZONE = 'America/New_York'
|
||||
# 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?
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'en'
|
||||
# FIXME: We should iterate through the courses we have, adding the static
|
||||
# contents for each of them.
|
||||
STATICFILES_DIRS = (
|
||||
# FIXME: Need to add entries for book, data/images, etc.
|
||||
# PROJECT_ROOT / "static",
|
||||
ENV_ROOT / "static",
|
||||
ASKBOT_ROOT / "askbot" / "skins",
|
||||
# ("circuits", DATA_DIR / "images"),
|
||||
# ("handouts", DATA_DIR / "handouts"),
|
||||
# ("subs", DATA_DIR / "subs"),
|
||||
# ("book", TEXTBOOK_DIR)
|
||||
)
|
||||
|
||||
SITE_ID = 1
|
||||
print STATICFILES_DIRS
|
||||
|
||||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
# Templates
|
||||
TEMPLATE_DIRS = (
|
||||
ENV_ROOT / "templates",
|
||||
# PROJECT_ROOT / "templates",
|
||||
# DATA_DIR / "problems",
|
||||
)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.core.context_processors.request',
|
||||
'askbot.context.application_settings',
|
||||
#'django.core.context_processors.i18n',
|
||||
'askbot.user_messages.context_processors.user_messages',#must be before auth
|
||||
'django.core.context_processors.auth', #this is required for admin
|
||||
'django.core.context_processors.csrf', #necessary for csrf protection
|
||||
)
|
||||
|
||||
# Storage
|
||||
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
|
||||
MEDIA_ROOT = ENV_ROOT / "uploads"
|
||||
MEDIA_URL = "/discussion/upfiles/"
|
||||
FILE_UPLOAD_TEMP_DIR = os.path.join(os.path.dirname(__file__), 'tmp').replace('\\','/')
|
||||
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
|
||||
USE_I18N = True
|
||||
|
||||
# If you set this to False, Django will not format dates, numbers and
|
||||
# calendars according to the current locale
|
||||
USE_L10N = True
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# URL prefix for admin static files -- CSS, JavaScript and images.
|
||||
# Make sure to use a trailing slash.
|
||||
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
||||
ADMIN_MEDIA_PREFIX = '/static/admin/'
|
||||
|
||||
# List of finder classes that know how to find static files in
|
||||
# various locations.
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
)
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'track.middleware.TrackMiddleware',
|
||||
'mitxmako.middleware.MakoMiddleware',
|
||||
#'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'mitx.urls'
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'courseware',
|
||||
'student',
|
||||
'django.contrib.humanize',
|
||||
'static_template_view',
|
||||
'staticbook',
|
||||
'simplewiki',
|
||||
'track',
|
||||
'circuit',
|
||||
'perfstats',
|
||||
'util',
|
||||
# Uncomment the next line to enable the admin:
|
||||
# 'django.contrib.admin',
|
||||
# Uncomment the next line to enable admin documentation:
|
||||
# 'django.contrib.admindocs',
|
||||
)
|
||||
|
||||
#TRACK_DIR = None
|
||||
DEBUG_TRACK_LOG = False
|
||||
# Maximum length of a tracking string. We don't want e.g. a file upload in our log
|
||||
TRACK_MAX_EVENT = 1000
|
||||
# Maximum length of log file before starting a new one.
|
||||
MAXLOG = 500
|
||||
|
||||
LOG_DIR = "/tmp/"
|
||||
MAKO_MODULE_DIR = None
|
||||
|
||||
# Make sure we execute correctly regardless of where we're called from
|
||||
execfile(os.path.join(BASE_DIR, "settings.py"))
|
||||
|
||||
if MAKO_MODULE_DIR == None:
|
||||
MAKO_MODULE_DIR = tempfile.mkdtemp('mako')
|
||||
|
||||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
# the site admins on every HTTP 500 error.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
|
||||
pid = os.getpid()
|
||||
################################### LOGGING ####################################
|
||||
# Might want to rewrite this to use logger code and push more things to the root
|
||||
# logger.
|
||||
pid = os.getpid() # So we can log which process is creating the log
|
||||
hostname = platform.node().split(".")[0]
|
||||
SYSLOG_ADDRESS = ('syslog.m.i4x.org', 514)
|
||||
|
||||
handlers = ['console']
|
||||
if not DEBUG:
|
||||
handlers.append('syslogger')
|
||||
# FIXME: re-enable syslogger later
|
||||
# if not DEBUG:
|
||||
# handlers.append('syslogger')
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
@@ -184,7 +184,7 @@ LOGGING = {
|
||||
},
|
||||
'handlers' : {
|
||||
'console' : {
|
||||
'level' : 'DEBUG' if DEBUG else 'INFO',
|
||||
'level' : 'DEBUG',
|
||||
'class' : 'logging.StreamHandler',
|
||||
'formatter' : 'standard',
|
||||
'stream' : sys.stdout,
|
||||
@@ -230,104 +230,28 @@ LOGGING = {
|
||||
}
|
||||
}
|
||||
|
||||
#################################### AWS #######################################
|
||||
# S3BotoStorage insists on a timeout for uploaded assets. We should make it
|
||||
# permanent instead, but rather than trying to figure out exactly where that
|
||||
# setting is, I'm just bumping the expiration time to something absurd (100
|
||||
# years). This is only used if DEFAULT_FILE_STORAGE is overriden to use S3
|
||||
# in the global settings.py
|
||||
AWS_QUERYSTRING_EXPIRE = 10 * 365 * 24 * 60 * 60 # 10 years
|
||||
|
||||
|
||||
if PERFSTATS :
|
||||
MIDDLEWARE_CLASSES = ( 'perfstats.middleware.ProfileMiddleware',) + MIDDLEWARE_CLASSES
|
||||
|
||||
if 'TRACK_DIR' not in locals():
|
||||
TRACK_DIR = BASE_DIR+'/track_dir/'
|
||||
if 'STATIC_ROOT' not in locals():
|
||||
STATIC_ROOT = BASE_DIR+'/staticroot/'
|
||||
if 'DATA_DIR' not in locals():
|
||||
DATA_DIR = BASE_DIR+'/data/'
|
||||
if 'TEXTBOOK_DIR' not in locals():
|
||||
TEXTBOOK_DIR = BASE_DIR+'/textbook/'
|
||||
|
||||
if 'TEMPLATE_DIRS' not in locals():
|
||||
TEMPLATE_DIRS = (
|
||||
BASE_DIR+'/templates/',
|
||||
DATA_DIR+'/templates',
|
||||
TEXTBOOK_DIR,
|
||||
)
|
||||
|
||||
if 'STATICFILES_DIRS' not in locals():
|
||||
STATICFILES_DIRS = (
|
||||
BASE_DIR+'/3rdParty/static',
|
||||
BASE_DIR+'/static',
|
||||
)
|
||||
|
||||
|
||||
if 'ASKBOT_EXTRA_SKINS_DIR' not in locals():
|
||||
ASKBOT_EXTRA_SKINS_DIR = BASE_DIR+'/askbot-devel/askbot/skins'
|
||||
if 'ASKBOT_DIR' not in locals():
|
||||
ASKBOT_DIR = BASE_DIR+'/askbot-devel'
|
||||
|
||||
sys.path.append(ASKBOT_DIR)
|
||||
import askbot
|
||||
import site
|
||||
|
||||
STATICFILES_DIRS = STATICFILES_DIRS + ( ASKBOT_DIR+'/askbot/skins',)
|
||||
|
||||
ASKBOT_ROOT = os.path.dirname(askbot.__file__)
|
||||
|
||||
# Needed for Askbot
|
||||
# Deployed machines: Move to S3
|
||||
if MEDIA_ROOT == '':
|
||||
MEDIA_ROOT = ASKBOT_DIR+'/askbot/upfiles'
|
||||
if MEDIA_URL == '':
|
||||
MEDIA_URL = '/discussion/upfiles/'
|
||||
|
||||
site.addsitedir(os.path.join(os.path.dirname(askbot.__file__), 'deps'))
|
||||
TEMPLATE_LOADERS = TEMPLATE_LOADERS + ('askbot.skins.loaders.filesystem_load_template_source',)
|
||||
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
|
||||
'util.middleware.ExceptionLoggingMiddleware',
|
||||
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
|
||||
'askbot.middleware.forum_mode.ForumModeMiddleware',
|
||||
'askbot.middleware.cancel.CancelActionMiddleware',
|
||||
'django.middleware.transaction.TransactionMiddleware',
|
||||
#'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
'askbot.middleware.view_log.ViewLogMiddleware',
|
||||
'askbot.middleware.spaceless.SpacelessMiddleware',
|
||||
# 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
|
||||
)
|
||||
|
||||
FILE_UPLOAD_TEMP_DIR = os.path.join(os.path.dirname(__file__), 'tmp').replace('\\','/')
|
||||
FILE_UPLOAD_HANDLERS = (
|
||||
'django.core.files.uploadhandler.MemoryFileUploadHandler',
|
||||
'django.core.files.uploadhandler.TemporaryFileUploadHandler',
|
||||
)
|
||||
################################### ASKBOT #####################################
|
||||
ASKBOT_EXTRA_SKINS_DIR = ASKBOT_ROOT / "askbot" / "skins"
|
||||
ASKBOT_ALLOWED_UPLOAD_FILE_TYPES = ('.jpg', '.jpeg', '.gif', '.bmp', '.png', '.tiff')
|
||||
ASKBOT_MAX_UPLOAD_FILE_SIZE = 1024 * 1024 #result in bytes
|
||||
# ASKBOT_FILE_UPLOAD_DIR = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
|
||||
ASKBOT_MAX_UPLOAD_FILE_SIZE = 1024 * 1024 # result in bytes
|
||||
|
||||
PROJECT_ROOT = os.path.dirname(__file__)
|
||||
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
|
||||
ASKBOT_URL = 'discussion/'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGIN_URL = '/'
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.core.context_processors.request',
|
||||
'askbot.context.application_settings',
|
||||
#'django.core.context_processors.i18n',
|
||||
'askbot.user_messages.context_processors.user_messages',#must be before auth
|
||||
'django.core.context_processors.auth', #this is required for admin
|
||||
'django.core.context_processors.csrf', #necessary for csrf protection
|
||||
)
|
||||
ALLOW_UNICODE_SLUGS = False
|
||||
ASKBOT_USE_STACKEXCHANGE_URLS = False # mimic url scheme of stackexchange
|
||||
ASKBOT_CSS_DEVEL = True
|
||||
|
||||
INSTALLED_APPS = INSTALLED_APPS + (
|
||||
'django.contrib.sitemaps',
|
||||
'django.contrib.admin',
|
||||
'south',
|
||||
'askbot.deps.livesettings',
|
||||
'askbot',
|
||||
#'keyedcache', # TODO: Main askbot tree has this installed, but we get intermittent errors if we include it.
|
||||
'robots',
|
||||
'django_countries',
|
||||
'djcelery',
|
||||
'djkombu',
|
||||
'followit',
|
||||
)
|
||||
|
||||
# askbot livesettings
|
||||
LIVESETTINGS_OPTIONS = {
|
||||
1: {
|
||||
'SETTINGS' : {
|
||||
@@ -368,25 +292,93 @@ LIVESETTINGS_OPTIONS = {
|
||||
'EDITABLE_EMAIL' : False,
|
||||
'ALLOW_ADD_REMOVE_LOGIN_METHODS' : False,
|
||||
'ENABLE_GRAVATAR' : False,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
|
||||
ASKBOT_URL = 'discussion/'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGIN_URL = '/'
|
||||
|
||||
# ASKBOT_UPLOADED_FILES_URL = '%s%s' % (ASKBOT_URL, 'upfiles/')
|
||||
ALLOW_UNICODE_SLUGS = False
|
||||
ASKBOT_USE_STACKEXCHANGE_URLS = False #mimic url scheme of stackexchange
|
||||
ASKBOT_CSS_DEVEL = True
|
||||
|
||||
# Celery Settings
|
||||
BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"
|
||||
CELERY_ALWAYS_EAGER = True
|
||||
|
||||
djcelery.setup_loader()
|
||||
|
||||
################################# SIMPLEWIKI ###################################
|
||||
WIKI_REQUIRE_LOGIN_EDIT = True
|
||||
WIKI_REQUIRE_LOGIN_VIEW = True
|
||||
|
||||
################################# Middleware ###################################
|
||||
# List of finder classes that know how to find static files in
|
||||
# various locations.
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
)
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
'askbot.skins.loaders.filesystem_load_template_source',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'util.middleware.ExceptionLoggingMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'track.middleware.TrackMiddleware',
|
||||
'mitxmako.middleware.MakoMiddleware',
|
||||
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
|
||||
'askbot.middleware.forum_mode.ForumModeMiddleware',
|
||||
'askbot.middleware.cancel.CancelActionMiddleware',
|
||||
'django.middleware.transaction.TransactionMiddleware',
|
||||
'askbot.middleware.view_log.ViewLogMiddleware',
|
||||
'askbot.middleware.spaceless.SpacelessMiddleware',
|
||||
# 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
|
||||
)
|
||||
|
||||
################################### APPS #######################################
|
||||
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
|
||||
code check fo the value of these constants.
|
||||
"""
|
||||
# We always install these
|
||||
STANDARD_APPS = ['django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.humanize',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'track',
|
||||
'util']
|
||||
COURSEWARE_APPS = ['circuit',
|
||||
'courseware',
|
||||
'student',
|
||||
'static_template_view',
|
||||
'staticbook',
|
||||
'simplewiki',
|
||||
'perfstats']
|
||||
ASKBOT_APPS = ['django.contrib.sitemaps',
|
||||
'django.contrib.admin',
|
||||
'south',
|
||||
'askbot.deps.livesettings',
|
||||
'askbot',
|
||||
'keyedcache',
|
||||
'robots',
|
||||
'django_countries',
|
||||
'djcelery',
|
||||
'djkombu',
|
||||
'followit']
|
||||
|
||||
return tuple(STANDARD_APPS +
|
||||
(COURSEWARE_APPS if COURSEWARE_ENABLED else []) +
|
||||
(ASKBOT_APPS if ASKBOT_ENABLED else []))
|
||||
|
||||
INSTALLED_APPS = installed_apps()
|
||||
28
settings2/dev.py
Normal file
28
settings2/dev.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
This config file runs the simplest dev environment using sqlite, and db-based
|
||||
sessions.
|
||||
"""
|
||||
from common import *
|
||||
|
||||
CSRF_COOKIE_DOMAIN = 'localhost'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': ENV_ROOT / "db" / "mitx.db",
|
||||
}
|
||||
}
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = False
|
||||
|
||||
# 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()
|
||||
35
settings2/devplus.py
Normal file
35
settings2/devplus.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
This config file tries to mimic the production environment more closely than the
|
||||
normal dev.py. It assumes you're running a local instance of MySQL 5.1 and that
|
||||
you're running memcached.
|
||||
"""
|
||||
from common import *
|
||||
|
||||
CSRF_COOKIE_DOMAIN = 'localhost'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'NAME': 'wwc', # Or path to database file if using sqlite3.
|
||||
'USER': 'root', # Not used with sqlite3.
|
||||
'PASSWORD': '', # Not used with sqlite3.
|
||||
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
|
||||
'PORT': '3306', # Set to empty string for default. Not used with sqlite3.
|
||||
}
|
||||
}
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = True
|
||||
3
settings2/loadtest.py
Normal file
3
settings2/loadtest.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from common import *
|
||||
|
||||
GENERATE_RANDOM_USER_CREDENTIALS = True
|
||||
13
settings2/staging.py
Normal file
13
settings2/staging.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from aws import *
|
||||
|
||||
# Staging specific overrides
|
||||
SITE_NAME = "staging.mitx.mit.edu"
|
||||
AWS_STORAGE_BUCKET_NAME = 'mitx_askbot_stage'
|
||||
CACHES['default']['LOCATION'] = ['***REMOVED***',
|
||||
'***REMOVED***']
|
||||
|
||||
### Secure Data Below Here ###
|
||||
SECRET_KEY = ""
|
||||
AWS_ACCESS_KEY_ID = ""
|
||||
AWS_SECRET_ACCESS_KEY = ""
|
||||
|
||||
@@ -1,245 +0,0 @@
|
||||
if 'COURSEWARE_ENABLED' not in locals():
|
||||
COURSEWARE_ENABLED = True
|
||||
if 'ASKBOT_ENABLED' not in locals():
|
||||
ASKBOT_ENABLED = True
|
||||
if not COURSEWARE_ENABLED:
|
||||
ASKBOT_ENABLED = False
|
||||
|
||||
# Defaults to be overridden
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
SITE_NAME = "localhost:8000"
|
||||
|
||||
DEFAULT_FROM_EMAIL = 'registration@mitx.mit.edu'
|
||||
DEFAULT_FEEDBACK_EMAIL = 'feedback@mitx.mit.edu'
|
||||
|
||||
# For testing the login system
|
||||
GENERATE_RANDOM_USER_CREDENTIALS = False
|
||||
|
||||
WIKI_REQUIRE_LOGIN_EDIT = True
|
||||
WIKI_REQUIRE_LOGIN_VIEW = True
|
||||
|
||||
PERFSTATS = False
|
||||
|
||||
HTTPS = 'on'
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
('Piotr Mitros', 'staff@csail.mit.edu'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
TIME_ZONE = 'America/Chicago'
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'en'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = True
|
||||
|
||||
# If you set this to False, Django will not format dates, numbers and
|
||||
# calendars according to the current locale
|
||||
USE_L10N = True
|
||||
|
||||
#MEDIA_ROOT = ''
|
||||
#MEDIA_URL = ''
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# URL prefix for admin static files -- CSS, JavaScript and images.
|
||||
# Make sure to use a trailing slash.
|
||||
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
||||
ADMIN_MEDIA_PREFIX = '/static/admin/'
|
||||
|
||||
|
||||
# List of finder classes that know how to find static files in
|
||||
# various locations.
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
)
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'track.middleware.TrackMiddleware',
|
||||
'mitxmako.middleware.MakoMiddleware',
|
||||
#'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'mitx.urls'
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'courseware',
|
||||
'auth',
|
||||
'django.contrib.humanize',
|
||||
'static_template_view',
|
||||
'staticbook',
|
||||
'simplewiki',
|
||||
'track',
|
||||
'circuit',
|
||||
'perfstats',
|
||||
# Uncomment the next line to enable the admin:
|
||||
# 'django.contrib.admin',
|
||||
# Uncomment the next line to enable admin documentation:
|
||||
# 'django.contrib.admindocs',
|
||||
)
|
||||
|
||||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
# the site admins on every HTTP 500 error.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
'propagate': True,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#TRACK_DIR = None
|
||||
DEBUG_TRACK_LOG = False
|
||||
# Maximum length of a tracking string. We don't want e.g. a file upload in our log
|
||||
TRACK_MAX_EVENT = 1000
|
||||
# Maximum length of log file before starting a new one.
|
||||
MAXLOG = 500
|
||||
|
||||
execfile("../settings.py")
|
||||
|
||||
if PERFSTATS :
|
||||
MIDDLEWARE_CLASSES = ( 'perfstats.middleware.ProfileMiddleware',) + MIDDLEWARE_CLASSES
|
||||
|
||||
if 'TRACK_DIR' not in locals():
|
||||
TRACK_DIR = BASE_DIR+'/track_dir/'
|
||||
if 'ASKBOT_EXTRA_SKINS_DIR' not in locals():
|
||||
ASKBOT_EXTRA_SKINS_DIR = BASE_DIR+'/askbot/skins'
|
||||
if 'ASKBOT_DIR' not in locals():
|
||||
ASKBOT_DIR = BASE_DIR
|
||||
if 'STATIC_ROOT' not in locals():
|
||||
STATIC_ROOT = BASE_DIR+'/staticroot/'
|
||||
if 'DATA_DIR' not in locals():
|
||||
DATA_DIR = BASE_DIR+'/data/'
|
||||
if 'TEXTBOOK_DIR' not in locals():
|
||||
TEXTBOOK_DIR = BASE_DIR+'/textbook/'
|
||||
|
||||
if 'TEMPLATE_DIRS' not in locals():
|
||||
TEMPLATE_DIRS = (
|
||||
BASE_DIR+'/templates/',
|
||||
DATA_DIR+'/templates',
|
||||
TEXTBOOK_DIR,
|
||||
)
|
||||
|
||||
if 'STATICFILES_DIRS' not in locals():
|
||||
STATICFILES_DIRS = (
|
||||
BASE_DIR+'/3rdParty/static',
|
||||
BASE_DIR+'/static'
|
||||
)
|
||||
|
||||
if ASKBOT_ENABLED:
|
||||
import sys
|
||||
sys.path.append(ASKBOT_DIR)
|
||||
import os
|
||||
import askbot
|
||||
import site
|
||||
site.addsitedir(os.path.join(os.path.dirname(askbot.__file__), 'deps'))
|
||||
TEMPLATE_LOADERS = TEMPLATE_LOADERS + ('askbot.skins.loaders.filesystem_load_template_source',)
|
||||
|
||||
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
|
||||
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
|
||||
'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
|
||||
'askbot.middleware.cancel.CancelActionMiddleware',
|
||||
'django.middleware.transaction.TransactionMiddleware',
|
||||
'askbot.middleware.view_log.ViewLogMiddleware',
|
||||
'askbot.middleware.spaceless.SpacelessMiddleware',
|
||||
'askbot.middleware.forum_mode.ForumModeMiddleware',
|
||||
)
|
||||
|
||||
FILE_UPLOAD_TEMP_DIR = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'tmp'
|
||||
).replace('\\','/')
|
||||
FILE_UPLOAD_HANDLERS = (
|
||||
'django.core.files.uploadhandler.MemoryFileUploadHandler',
|
||||
'django.core.files.uploadhandler.TemporaryFileUploadHandler',
|
||||
)
|
||||
ASKBOT_ALLOWED_UPLOAD_FILE_TYPES = ('.jpg', '.jpeg', '.gif', '.bmp', '.png', '.tiff')
|
||||
ASKBOT_MAX_UPLOAD_FILE_SIZE = 1024 * 1024 #result in bytes
|
||||
ASKBOT_FILE_UPLOAD_DIR = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
|
||||
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
|
||||
|
||||
PROJECT_ROOT = os.path.dirname(__file__)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.core.context_processors.request',
|
||||
'askbot.context.application_settings',
|
||||
#'django.core.context_processors.i18n',
|
||||
'askbot.user_messages.context_processors.user_messages',#must be before auth
|
||||
'django.core.context_processors.auth', #this is required for admin
|
||||
'django.core.context_processors.csrf', #necessary for csrf protection
|
||||
)
|
||||
|
||||
INSTALLED_APPS = INSTALLED_APPS + (
|
||||
'django.contrib.sitemaps',
|
||||
'django.contrib.admin',
|
||||
'south',
|
||||
'askbot.deps.livesettings',
|
||||
'askbot',
|
||||
#'keyedcache', # TODO: Main askbot tree has this installed, but we get intermittent errors if we include it.
|
||||
'robots',
|
||||
'django_countries',
|
||||
'djcelery',
|
||||
'djkombu',
|
||||
'followit',
|
||||
)
|
||||
|
||||
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
|
||||
ASKBOT_URL = 'discussion/'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGIN_URL = '/'
|
||||
|
||||
ASKBOT_UPLOADED_FILES_URL = '%s%s' % (ASKBOT_URL, 'upfiles/')
|
||||
ALLOW_UNICODE_SLUGS = False
|
||||
ASKBOT_USE_STACKEXCHANGE_URLS = False #mimic url scheme of stackexchange
|
||||
ASKBOT_CSS_DEVEL = True
|
||||
|
||||
#Celery Settings
|
||||
BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"
|
||||
CELERY_ALWAYS_EAGER = True
|
||||
|
||||
import djcelery
|
||||
djcelery.setup_loader()
|
||||
Reference in New Issue
Block a user