Commit 68014125 by chrisndodge

Merge pull request #856 from MITx/feature/cale/edge-configs

Configuration changes to get edge running on AWS
parents e2d3ca6f cf19a432
...@@ -3,8 +3,8 @@ This is the default template for our main set of AWS servers. ...@@ -3,8 +3,8 @@ This is the default template for our main set of AWS servers.
""" """
import json import json
from .logsettings import get_logger_config
from .common import * from .common import *
from logsettings import get_logger_config
############################### ALWAYS THE SAME ################################ ############################### ALWAYS THE SAME ################################
DEBUG = False DEBUG = False
...@@ -27,6 +27,8 @@ LOG_DIR = ENV_TOKENS['LOG_DIR'] ...@@ -27,6 +27,8 @@ LOG_DIR = ENV_TOKENS['LOG_DIR']
CACHES = ENV_TOKENS['CACHES'] CACHES = ENV_TOKENS['CACHES']
SESSION_COOKIE_DOMAIN = ENV_TOKENS.get('SESSION_COOKIE_DOMAIN')
for feature, value in ENV_TOKENS.get('MITX_FEATURES', {}).items(): for feature, value in ENV_TOKENS.get('MITX_FEATURES', {}).items():
MITX_FEATURES[feature] = value MITX_FEATURES[feature] = value
...@@ -48,3 +50,4 @@ AWS_ACCESS_KEY_ID = AUTH_TOKENS["AWS_ACCESS_KEY_ID"] ...@@ -48,3 +50,4 @@ AWS_ACCESS_KEY_ID = AUTH_TOKENS["AWS_ACCESS_KEY_ID"]
AWS_SECRET_ACCESS_KEY = AUTH_TOKENS["AWS_SECRET_ACCESS_KEY"] AWS_SECRET_ACCESS_KEY = AUTH_TOKENS["AWS_SECRET_ACCESS_KEY"]
DATABASES = AUTH_TOKENS['DATABASES'] DATABASES = AUTH_TOKENS['DATABASES']
MODULESTORE = AUTH_TOKENS['MODULESTORE'] MODULESTORE = AUTH_TOKENS['MODULESTORE']
CONTENTSTORE = AUTH_TOKENS['CONTENTSTORE']
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
This config file runs the simplest dev environment""" This config file runs the simplest dev environment"""
from .common import * from .common import *
from .logsettings import get_logger_config from logsettings import get_logger_config
import logging import logging
import sys import sys
......
import os
import os.path
import platform
import sys
def get_logger_config(log_dir,
logging_env="no_env",
tracking_filename=None,
syslog_addr=None,
debug=False):
"""Return the appropriate logging config dictionary. You should assign the
result of this to the LOGGING var in your settings. The reason it's done
this way instead of registering directly is because I didn't want to worry
about resetting the logging state if this is called multiple times when
settings are extended."""
# If we're given an explicit place to put tracking logs, we do that (say for
# debugging). However, logging is not safe for multiple processes hitting
# the same file. So if it's left blank, we dynamically create the filename
# based on the PID of this worker process.
if tracking_filename:
tracking_file_loc = os.path.join(log_dir, tracking_filename)
else:
pid = os.getpid() # So we can log which process is creating the log
tracking_file_loc = os.path.join(log_dir, "tracking_{0}.log".format(pid))
hostname = platform.node().split(".")[0]
syslog_format = ("[%(name)s][env:{logging_env}] %(levelname)s [{hostname} " +
" %(process)d] [%(filename)s:%(lineno)d] - %(message)s").format(
logging_env=logging_env, hostname=hostname)
handlers = ['console'] if debug else ['console', 'syslogger', 'newrelic']
return {
'version': 1,
'disable_existing_loggers': False,
'formatters' : {
'standard' : {
'format' : '%(asctime)s %(levelname)s %(process)d [%(name)s] %(filename)s:%(lineno)d - %(message)s',
},
'syslog_format' : { 'format' : syslog_format },
'raw' : { 'format' : '%(message)s' },
},
'handlers' : {
'console' : {
'level' : 'DEBUG' if debug else 'INFO',
'class' : 'logging.StreamHandler',
'formatter' : 'standard',
'stream' : sys.stdout,
},
'syslogger' : {
'level' : 'INFO',
'class' : 'logging.handlers.SysLogHandler',
'address' : syslog_addr,
'formatter' : 'syslog_format',
},
'tracking' : {
'level' : 'DEBUG',
'class' : 'logging.handlers.WatchedFileHandler',
'filename' : tracking_file_loc,
'formatter' : 'raw',
},
'newrelic' : {
'level': 'ERROR',
'class': 'newrelic_logging.NewRelicHandler',
'formatter': 'raw',
}
},
'loggers' : {
'django' : {
'handlers' : handlers,
'propagate' : True,
'level' : 'INFO'
},
'tracking' : {
'handlers' : ['tracking'],
'level' : 'DEBUG',
'propagate' : False,
},
'' : {
'handlers' : handlers,
'level' : 'DEBUG',
'propagate' : False
},
'mitx' : {
'handlers' : handlers,
'level' : 'DEBUG',
'propagate' : False
},
'keyedcache' : {
'handlers' : handlers,
'level' : 'DEBUG',
'propagate' : False
},
}
}
...@@ -44,6 +44,8 @@ urlpatterns = ('', ...@@ -44,6 +44,8 @@ urlpatterns = ('',
# temporary landing page for edge # temporary landing page for edge
url(r'^edge$', 'contentstore.views.edge', name='edge'), url(r'^edge$', 'contentstore.views.edge', name='edge'),
url(r'^heartbeat$', include('heartbeat.urls')),
) )
# User creation and updating views # User creation and updating views
......
...@@ -14,9 +14,13 @@ from xmodule.exceptions import NotFoundError ...@@ -14,9 +14,13 @@ from xmodule.exceptions import NotFoundError
class MongoContentStore(ContentStore): class MongoContentStore(ContentStore):
def __init__(self, host, db, port=27017): def __init__(self, host, db, port=27017, user=None, password=None, **kwargs):
logging.debug( 'Using MongoDB for static content serving at host={0} db={1}'.format(host,db)) logging.debug( 'Using MongoDB for static content serving at host={0} db={1}'.format(host,db))
_db = Connection(host=host, port=port)[db] _db = Connection(host=host, port=port, **kwargs)[db]
if self.user is not None and self.password is not None:
_db.authenticate(user, password)
self.fs = gridfs.GridFS(_db) self.fs = gridfs.GridFS(_db)
self.fs_files = _db["fs.files"] # the underlying collection GridFS uses self.fs_files = _db["fs.files"] # the underlying collection GridFS uses
......
...@@ -97,15 +97,21 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -97,15 +97,21 @@ class MongoModuleStore(ModuleStoreBase):
# TODO (cpennington): Enable non-filesystem filestores # TODO (cpennington): Enable non-filesystem filestores
def __init__(self, host, db, collection, fs_root, render_template, def __init__(self, host, db, collection, fs_root, render_template,
port=27017, default_class=None, port=27017, default_class=None,
error_tracker=null_error_tracker): error_tracker=null_error_tracker,
user=None, password=None, **kwargs):
ModuleStoreBase.__init__(self) ModuleStoreBase.__init__(self)
self.collection = pymongo.connection.Connection( self.collection = pymongo.connection.Connection(
host=host, host=host,
port=port port=port,
**kwargs
)[db][collection] )[db][collection]
if user is not None and password is not None:
self.collection.database.authenticate(user, password)
# Force mongo to report errors, at the expense of performance # Force mongo to report errors, at the expense of performance
self.collection.safe = True self.collection.safe = True
......
...@@ -409,7 +409,7 @@ class XModuleDescriptor(Plugin, HTMLSnippet, ResourceTemplates): ...@@ -409,7 +409,7 @@ class XModuleDescriptor(Plugin, HTMLSnippet, ResourceTemplates):
# cdodge: this is a list of metadata names which are 'system' metadata # cdodge: this is a list of metadata names which are 'system' metadata
# and should not be edited by an end-user # and should not be edited by an end-user
system_metadata_fields = ['data_dir', 'published_date', 'published_by'] system_metadata_fields = ['data_dir', 'published_date', 'published_by', 'is_draft']
# A list of descriptor attributes that must be equal for the descriptors to # A list of descriptor attributes that must be equal for the descriptors to
# be equal # be equal
......
...@@ -220,9 +220,6 @@ def get_default_tabs(user, course, active_page): ...@@ -220,9 +220,6 @@ def get_default_tabs(user, course, active_page):
link = reverse('django_comment_client.forum.views.forum_form_discussion', link = reverse('django_comment_client.forum.views.forum_form_discussion',
args=[course.id]) args=[course.id])
tabs.append(CourseTab('Discussion', link, active_page == 'discussion')) tabs.append(CourseTab('Discussion', link, active_page == 'discussion'))
elif settings.MITX_FEATURES.get('ENABLE_DISCUSSION'):
## This is Askbot, which we should be retiring soon...
tabs.append(CourseTab('Discussion', reverse('questions'), active_page == 'discussion'))
tabs.extend(_wiki({'name': 'Wiki', 'type': 'wiki'}, user, course, active_page)) tabs.extend(_wiki({'name': 'Wiki', 'type': 'wiki'}, user, course, active_page))
......
"""
There are other askbot settings in common.py that covers things like where the
templates are located, etc. This file is purely for askbot forum *behavior*.
This means things like karma limits, the ability to post questions as wikis,
anonymous questions, etc.
"""
LIVESETTINGS_OPTIONS = {
1: {
'DB' : False,
'SETTINGS' : {
'ACCESS_CONTROL' : {
'ASKBOT_CLOSED_FORUM_MODE' : True,
},
'BADGES' : {
'DISCIPLINED_BADGE_MIN_UPVOTES' : 3,
'PEER_PRESSURE_BADGE_MIN_DOWNVOTES' : 3,
'TEACHER_BADGE_MIN_UPVOTES' : 1,
'NICE_ANSWER_BADGE_MIN_UPVOTES' : 2,
'GOOD_ANSWER_BADGE_MIN_UPVOTES' : 3,
'GREAT_ANSWER_BADGE_MIN_UPVOTES' : 5,
'NICE_QUESTION_BADGE_MIN_UPVOTES' : 2,
'GOOD_QUESTION_BADGE_MIN_UPVOTES' : 3,
'GREAT_QUESTION_BADGE_MIN_UPVOTES' : 5,
'POPULAR_QUESTION_BADGE_MIN_VIEWS' : 150,
'NOTABLE_QUESTION_BADGE_MIN_VIEWS' : 250,
'FAMOUS_QUESTION_BADGE_MIN_VIEWS' : 500,
'SELF_LEARNER_BADGE_MIN_UPVOTES' : 1,
'CIVIC_DUTY_BADGE_MIN_VOTES' : 100,
'ENLIGHTENED_BADGE_MIN_UPVOTES' : 3,
'ASSOCIATE_EDITOR_BADGE_MIN_EDITS' : 20,
'COMMENTATOR_BADGE_MIN_COMMENTS' : 10,
'ENTHUSIAST_BADGE_MIN_DAYS' : 30,
'FAVORITE_QUESTION_BADGE_MIN_STARS' : 3,
'GURU_BADGE_MIN_UPVOTES' : 5,
'NECROMANCER_BADGE_MIN_DELAY' : 30,
'NECROMANCER_BADGE_MIN_UPVOTES' : 1,
'STELLAR_QUESTION_BADGE_MIN_STARS' : 5,
'TAXONOMIST_BADGE_MIN_USE_COUNT' : 10,
},
'EMAIL' : {
'EMAIL_SUBJECT_PREFIX' : u'[Django] ',
'EMAIL_UNIQUE' : True,
'EMAIL_VALIDATION' : False,
'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_M_AND_C' : u'w',
'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_ALL' : u'w',
'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_ANS' : u'w',
'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_ASK' : u'w',
'DEFAULT_NOTIFICATION_DELIVERY_SCHEDULE_Q_SEL' : u'w',
'ENABLE_UNANSWERED_REMINDERS' : False,
'DAYS_BEFORE_SENDING_UNANSWERED_REMINDER' : 1,
'UNANSWERED_REMINDER_FREQUENCY' : 1,
'MAX_UNANSWERED_REMINDERS' : 5,
'ENABLE_ACCEPT_ANSWER_REMINDERS' : False,
'DAYS_BEFORE_SENDING_ACCEPT_ANSWER_REMINDER' : 3,
'ACCEPT_ANSWER_REMINDER_FREQUENCY' : 3,
'MAX_ACCEPT_ANSWER_REMINDERS' : 5,
'ANONYMOUS_USER_EMAIL' : u'anonymous@askbot.org',
'ALLOW_ASKING_BY_EMAIL' : False,
'REPLACE_SPACE_WITH_DASH_IN_EMAILED_TAGS' : True,
'MAX_ALERTS_PER_EMAIL' : 7,
},
'EMBEDDABLE_WIDGETS' : {
'QUESTIONS_WIDGET_CSS' : u"\nbody {\n overflow: hidden;\n}\n#container {\n width: 200px;\n height: 350px;\n}\nul {\n list-style: none;\n padding: 5px;\n margin: 5px;\n}\nli {\n border-bottom: #CCC 1px solid;\n padding-bottom: 5px;\n padding-top: 5px;\n}\nli:last-child {\n border: none;\n}\na {\n text-decoration: none;\n color: #464646;\n font-family: 'Yanone Kaffeesatz', sans-serif;\n font-size: 15px;\n}\n",
'QUESTIONS_WIDGET_FOOTER' : u"\n<link \n href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:300,400,700'\n rel='stylesheet'\n type='text/css'\n>\n",
'QUESTIONS_WIDGET_HEADER' : u'',
'QUESTIONS_WIDGET_MAX_QUESTIONS' : 7,
},
'EXTERNAL_KEYS' : {
'RECAPTCHA_KEY' : u'',
'RECAPTCHA_SECRET' : u'',
'FACEBOOK_KEY' : u'',
'FACEBOOK_SECRET' : u'',
'HOW_TO_CHANGE_LDAP_PASSWORD' : u'',
'IDENTICA_KEY' : u'',
'IDENTICA_SECRET' : u'',
'GOOGLE_ANALYTICS_KEY' : u'',
'GOOGLE_SITEMAP_CODE' : u'',
'LDAP_PROVIDER_NAME' : u'',
'LDAP_URL' : u'',
'LINKEDIN_KEY' : u'',
'LINKEDIN_SECRET' : u'',
'TWITTER_KEY' : u'',
'TWITTER_SECRET' : u'',
'USE_LDAP_FOR_PASSWORD_LOGIN' : False,
'USE_RECAPTCHA' : False,
},
'FLATPAGES' : {
'FORUM_ABOUT' : u'',
'FORUM_FAQ' : u'',
'FORUM_PRIVACY' : u'',
},
'FORUM_DATA_RULES' : {
'MIN_TITLE_LENGTH' : 1,
'MIN_QUESTION_BODY_LENGTH' : 1,
'MIN_ANSWER_BODY_LENGTH' : 1,
'WIKI_ON' : False,
'ALLOW_ASK_ANONYMOUSLY' : True,
'ALLOW_POSTING_BEFORE_LOGGING_IN' : False,
'ALLOW_SWAPPING_QUESTION_WITH_ANSWER' : False,
'MAX_TAG_LENGTH' : 20,
'MIN_TITLE_LENGTH' : 1,
'MIN_QUESTION_BODY_LENGTH' : 1,
'MIN_ANSWER_BODY_LENGTH' : 1,
'MANDATORY_TAGS' : u'',
'FORCE_LOWERCASE_TAGS' : False,
'TAG_LIST_FORMAT' : u'list',
'USE_WILDCARD_TAGS' : False,
'MAX_COMMENTS_TO_SHOW' : 5,
'MAX_COMMENT_LENGTH' : 300,
'USE_TIME_LIMIT_TO_EDIT_COMMENT' : True,
'MINUTES_TO_EDIT_COMMENT' : 10,
'SAVE_COMMENT_ON_ENTER' : True,
'MIN_SEARCH_WORD_LENGTH' : 4,
'DECOUPLE_TEXT_QUERY_FROM_SEARCH_STATE' : False,
'MAX_TAGS_PER_POST' : 5,
'DEFAULT_QUESTIONS_PAGE_SIZE' : u'30',
'UNANSWERED_QUESTION_MEANING' : u'NO_ACCEPTED_ANSWERS',
# Enabling video requires forked version of markdown
# pip uninstall markdown2
# pip install -e git+git://github.com/andryuha/python-markdown2.git#egg=markdown2
'ENABLE_VIDEO_EMBEDDING' : False,
},
'GENERAL_SKIN_SETTINGS' : {
'CUSTOM_CSS' : u'',
'CUSTOM_FOOTER' : u'',
'CUSTOM_HEADER' : u'',
'CUSTOM_HTML_HEAD' : u'',
'CUSTOM_JS' : u'',
'SITE_FAVICON' : u'/images/favicon.gif',
'SITE_LOGO_URL' : u'/images/logo.gif',
'SHOW_LOGO' : False,
'LOCAL_LOGIN_ICON' : u'/images/pw-login.gif',
'ALWAYS_SHOW_ALL_UI_FUNCTIONS' : False,
'ASKBOT_DEFAULT_SKIN' : u'mitx',
'USE_CUSTOM_HTML_HEAD' : False,
'FOOTER_MODE' : u'default',
'USE_CUSTOM_CSS' : False,
'USE_CUSTOM_JS' : False,
},
'LEADING_SIDEBAR' : {
'ENABLE_LEADING_SIDEBAR' : False,
'LEADING_SIDEBAR' : u'',
},
'LOGIN_PROVIDERS' : {
'PASSWORD_REGISTER_SHOW_PROVIDER_BUTTONS' : True,
'SIGNIN_ALWAYS_SHOW_LOCAL_LOGIN' : True,
'SIGNIN_AOL_ENABLED' : True,
'SIGNIN_BLOGGER_ENABLED' : True,
'SIGNIN_CLAIMID_ENABLED' : True,
'SIGNIN_FACEBOOK_ENABLED' : True,
'SIGNIN_FLICKR_ENABLED' : True,
'SIGNIN_GOOGLE_ENABLED' : True,
'SIGNIN_IDENTI.CA_ENABLED' : True,
'SIGNIN_LINKEDIN_ENABLED' : True,
'SIGNIN_LIVEJOURNAL_ENABLED' : True,
'SIGNIN_LOCAL_ENABLED' : True,
'SIGNIN_OPENID_ENABLED' : True,
'SIGNIN_TECHNORATI_ENABLED' : True,
'SIGNIN_TWITTER_ENABLED' : True,
'SIGNIN_VERISIGN_ENABLED' : True,
'SIGNIN_VIDOOP_ENABLED' : True,
'SIGNIN_WORDPRESS_ENABLED' : True,
'SIGNIN_WORDPRESS_SITE_ENABLED' : False,
'SIGNIN_YAHOO_ENABLED' : True,
'WORDPRESS_SITE_ICON' : u'/images/logo.gif',
'WORDPRESS_SITE_URL' : '',
},
'LICENSE_SETTINGS' : {
'LICENSE_ACRONYM' : u'cc-by-sa',
'LICENSE_LOGO_URL' : u'/images/cc-by-sa.png',
'LICENSE_TITLE' : u'Creative Commons Attribution Share Alike 3.0',
'LICENSE_URL' : 'http://creativecommons.org/licenses/by-sa/3.0/legalcode',
'LICENSE_USE_LOGO' : True,
'LICENSE_USE_URL' : True,
'USE_LICENSE' : True,
},
'MARKUP' : {
'MARKUP_CODE_FRIENDLY' : False,
'ENABLE_MATHJAX' : True,
'MATHJAX_BASE_URL' : u'/static/js/vendor/mathjax-MathJax-c9db6ac/',
'ENABLE_AUTO_LINKING' : False,
'AUTO_LINK_PATTERNS' : u'',
'AUTO_LINK_URLS' : u'',
},
'MIN_REP' : {
'MIN_REP_TO_ACCEPT_OWN_ANSWER' : 1,
'MIN_REP_TO_ANSWER_OWN_QUESTION' : 1,
'MIN_REP_TO_CLOSE_OTHERS_QUESTIONS' : 1200,
'MIN_REP_TO_CLOSE_OWN_QUESTIONS' : 1,
'MIN_REP_TO_DELETE_OTHERS_COMMENTS' : 5000,
'MIN_REP_TO_DELETE_OTHERS_POSTS' : 10000,
'MIN_REP_TO_EDIT_OTHERS_POSTS' : 5000,
'MIN_REP_TO_EDIT_WIKI' : 200,
'MIN_REP_TO_FLAG_OFFENSIVE' : 1,
'MIN_REP_TO_HAVE_STRONG_URL' : 250,
'MIN_REP_TO_LEAVE_COMMENTS' : 1,
'MIN_REP_TO_LOCK_POSTS' : 10000,
'MIN_REP_TO_REOPEN_OWN_QUESTIONS' : 1,
'MIN_REP_TO_RETAG_OTHERS_QUESTIONS' : 100,
'MIN_REP_TO_UPLOAD_FILES' : 1,
'MIN_REP_TO_VIEW_OFFENSIVE_FLAGS' : 2000,
'MIN_REP_TO_VOTE_DOWN' : 15,
'MIN_REP_TO_VOTE_UP' : 1,
},
'QA_SITE_SETTINGS' : {
'APP_COPYRIGHT' : u'Copyright Askbot, 2010-2011.',
'APP_DESCRIPTION' : u'Open source question and answer forum written in Python and Django',
'APP_KEYWORDS' : u'Askbot,CNPROG,forum,community',
'APP_SHORT_NAME' : u'Askbot',
'APP_TITLE' : u'Askbot: Open Source Q&A Forum',
'APP_URL' : u'http://askbot.org',
'FEEDBACK_SITE_URL' : u'',
'ENABLE_GREETING_FOR_ANON_USER' : True,
'GREETING_FOR_ANONYMOUS_USER' : u'First time here? Check out the FAQ!',
},
'REP_CHANGES' : {
'MAX_REP_GAIN_PER_USER_PER_DAY' : 200,
'REP_GAIN_FOR_ACCEPTING_ANSWER' : 2,
'REP_GAIN_FOR_CANCELING_DOWNVOTE' : 1,
'REP_GAIN_FOR_RECEIVING_ANSWER_ACCEPTANCE' : 15,
'REP_GAIN_FOR_RECEIVING_DOWNVOTE_CANCELATION' : 2,
'REP_GAIN_FOR_RECEIVING_UPVOTE' : 10,
'REP_LOSS_FOR_CANCELING_ANSWER_ACCEPTANCE' : -2,
'REP_LOSS_FOR_DOWNVOTING' : -2,
'REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE' : -5,
'REP_LOSS_FOR_RECEIVING_DOWNVOTE' : -1,
'REP_LOSS_FOR_RECEIVING_FIVE_FLAGS_PER_REVISION' : -100,
'REP_LOSS_FOR_RECEIVING_FLAG' : -2,
'REP_LOSS_FOR_RECEIVING_THREE_FLAGS_PER_REVISION' : -30,
'REP_LOSS_FOR_RECEIVING_UPVOTE_CANCELATION' : -10,
},
'SOCIAL_SHARING' : {
'ENABLE_SHARING_TWITTER' : False,
'ENABLE_SHARING_FACEBOOK' : False,
'ENABLE_SHARING_LINKEDIN' : False,
'ENABLE_SHARING_IDENTICA' : False,
'ENABLE_SHARING_GOOGLE' : False,
},
'SIDEBAR_MAIN' : {
'SIDEBAR_MAIN_AVATAR_LIMIT' : 16,
'SIDEBAR_MAIN_FOOTER' : u'',
'SIDEBAR_MAIN_HEADER' : u'',
'SIDEBAR_MAIN_SHOW_AVATARS' : True,
'SIDEBAR_MAIN_SHOW_TAGS' : True,
'SIDEBAR_MAIN_SHOW_TAG_SELECTOR' : True,
},
'SIDEBAR_PROFILE' : {
'SIDEBAR_PROFILE_FOOTER' : u'',
'SIDEBAR_PROFILE_HEADER' : u'',
},
'SIDEBAR_QUESTION' : {
'SIDEBAR_QUESTION_FOOTER' : u'',
'SIDEBAR_QUESTION_HEADER' : u'',
'SIDEBAR_QUESTION_SHOW_META' : True,
'SIDEBAR_QUESTION_SHOW_RELATED' : True,
'SIDEBAR_QUESTION_SHOW_TAGS' : True,
},
'SITE_MODES' : {
'ACTIVATE_BOOTSTRAP_MODE' : False,
},
'SKIN_COUNTER_SETTINGS' : {
},
'SPAM_AND_MODERATION' : {
'AKISMET_API_KEY' : u'',
'USE_AKISMET' : False,
},
'USER_SETTINGS' : {
'EDITABLE_SCREEN_NAME' : False,
'EDITABLE_EMAIL' : False,
'ALLOW_ADD_REMOVE_LOGIN_METHODS' : False,
'ENABLE_GRAVATAR' : False,
'GRAVATAR_TYPE' : u'identicon',
'NAME_OF_ANONYMOUS_USER' : u'',
'DEFAULT_AVATAR_URL' : u'/images/nophoto.png',
'MIN_USERNAME_LENGTH' : 1,
'ALLOW_ACCOUNT_RECOVERY_BY_EMAIL' : True,
},
'VOTE_RULES' : {
'MAX_VOTES_PER_USER_PER_DAY' : 30,
'MAX_FLAGS_PER_USER_PER_DAY' : 5,
'MIN_DAYS_FOR_STAFF_TO_ACCEPT_ANSWER' : 0,
'MIN_DAYS_TO_ANSWER_OWN_QUESTION' : 0,
'MIN_FLAGS_TO_DELETE_POST' : 5,
'MIN_FLAGS_TO_HIDE_POST' : 3,
'MAX_DAYS_TO_CANCEL_VOTE' : 1,
'VOTES_LEFT_WARNING_THRESHOLD' : 5,
},
},
},
}
...@@ -8,8 +8,8 @@ Common traits: ...@@ -8,8 +8,8 @@ Common traits:
""" """
import json import json
from .logsettings import get_logger_config
from .common import * from .common import *
from logsettings import get_logger_config
############################### ALWAYS THE SAME ################################ ############################### ALWAYS THE SAME ################################
DEBUG = False DEBUG = False
...@@ -20,7 +20,6 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.cache' ...@@ -20,7 +20,6 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
# Disable askbot, enable Berkeley forums # Disable askbot, enable Berkeley forums
MITX_FEATURES['ENABLE_DISCUSSION'] = False
MITX_FEATURES['ENABLE_DISCUSSION_SERVICE'] = True MITX_FEATURES['ENABLE_DISCUSSION_SERVICE'] = True
# IMPORTANT: With this enabled, the server must always be behind a proxy that # IMPORTANT: With this enabled, the server must always be behind a proxy that
...@@ -37,6 +36,7 @@ with open(ENV_ROOT / "env.json") as env_file: ...@@ -37,6 +36,7 @@ with open(ENV_ROOT / "env.json") as env_file:
ENV_TOKENS = json.load(env_file) ENV_TOKENS = json.load(env_file)
SITE_NAME = ENV_TOKENS['SITE_NAME'] SITE_NAME = ENV_TOKENS['SITE_NAME']
SESSION_COOKIE_DOMAIN = ENV_TOKENS.get('SESSION_COOKIE_DOMAIN')
BOOK_URL = ENV_TOKENS['BOOK_URL'] BOOK_URL = ENV_TOKENS['BOOK_URL']
MEDIA_URL = ENV_TOKENS['MEDIA_URL'] MEDIA_URL = ENV_TOKENS['MEDIA_URL']
...@@ -76,6 +76,11 @@ DATABASES = AUTH_TOKENS['DATABASES'] ...@@ -76,6 +76,11 @@ DATABASES = AUTH_TOKENS['DATABASES']
XQUEUE_INTERFACE = AUTH_TOKENS['XQUEUE_INTERFACE'] XQUEUE_INTERFACE = AUTH_TOKENS['XQUEUE_INTERFACE']
# Get the MODULESTORE from auth.json, but if it doesn't exist,
# use the one from common.py
MODULESTORE = AUTH_TOKENS.get('MODULESTORE', MODULESTORE)
CONTENTSTORE = AUTH_TOKENS.get('CONTENTSTORE', CONTENTSTORE)
if 'COURSE_ID' in ENV_TOKENS: if 'COURSE_ID' in ENV_TOKENS:
ASKBOT_URL = "courses/{0}/discussions/".format(ENV_TOKENS['COURSE_ID']) ASKBOT_URL = "courses/{0}/discussions/".format(ENV_TOKENS['COURSE_ID'])
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Settings for the LMS that runs alongside the CMS on AWS Settings for the LMS that runs alongside the CMS on AWS
""" """
from .aws import * from ..aws import *
with open(ENV_ROOT / "cms.auth.json") as auth_file: with open(ENV_ROOT / "cms.auth.json") as auth_file:
CMS_AUTH_TOKENS = json.load(auth_file) CMS_AUTH_TOKENS = json.load(auth_file)
......
...@@ -19,3 +19,11 @@ MODULESTORE = { ...@@ -19,3 +19,11 @@ MODULESTORE = {
'OPTIONS': modulestore_options 'OPTIONS': modulestore_options
}, },
} }
CONTENTSTORE = {
'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore',
'OPTIONS': {
'host': 'localhost',
'db' : 'xcontent',
}
}
...@@ -26,12 +26,10 @@ from xmodule.static_content import write_module_styles, write_module_js ...@@ -26,12 +26,10 @@ from xmodule.static_content import write_module_styles, write_module_js
import djcelery import djcelery
from path import path from path import path
from .askbotsettings import * # this is where LIVESETTINGS_OPTIONS comes from
from .discussionsettings import * from .discussionsettings import *
################################### FEATURES ################################### ################################### FEATURES ###################################
COURSEWARE_ENABLED = True COURSEWARE_ENABLED = True
ASKBOT_ENABLED = False
GENERATE_RANDOM_USER_CREDENTIALS = False GENERATE_RANDOM_USER_CREDENTIALS = False
PERFSTATS = False PERFSTATS = False
...@@ -65,7 +63,6 @@ MITX_FEATURES = { ...@@ -65,7 +63,6 @@ MITX_FEATURES = {
# set to None to do no university selection # set to None to do no university selection
'ENABLE_TEXTBOOK' : True, 'ENABLE_TEXTBOOK' : True,
'ENABLE_DISCUSSION' : False,
'ENABLE_DISCUSSION_SERVICE': True, 'ENABLE_DISCUSSION_SERVICE': True,
'ENABLE_PSYCHOMETRICS': False, # real-time psychometrics (eg item response theory analysis in instructor dashboard) 'ENABLE_PSYCHOMETRICS': False, # real-time psychometrics (eg item response theory analysis in instructor dashboard)
...@@ -97,15 +94,12 @@ PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /mitx/lms ...@@ -97,15 +94,12 @@ PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /mitx/lms
REPO_ROOT = PROJECT_ROOT.dirname() REPO_ROOT = PROJECT_ROOT.dirname()
COMMON_ROOT = REPO_ROOT / "common" COMMON_ROOT = REPO_ROOT / "common"
ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /mitx is in ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /mitx is in
ASKBOT_ROOT = REPO_ROOT / "askbot"
COURSES_ROOT = ENV_ROOT / "data" COURSES_ROOT = ENV_ROOT / "data"
# FIXME: To support multiple courses, we should walk the courses dir at startup # FIXME: To support multiple courses, we should walk the courses dir at startup
DATA_DIR = COURSES_ROOT DATA_DIR = COURSES_ROOT
sys.path.append(REPO_ROOT) sys.path.append(REPO_ROOT)
sys.path.append(ASKBOT_ROOT)
sys.path.append(ASKBOT_ROOT / "askbot" / "deps")
sys.path.append(PROJECT_ROOT / 'djangoapps') sys.path.append(PROJECT_ROOT / 'djangoapps')
sys.path.append(PROJECT_ROOT / 'lib') sys.path.append(PROJECT_ROOT / 'lib')
sys.path.append(COMMON_ROOT / 'djangoapps') sys.path.append(COMMON_ROOT / 'djangoapps')
...@@ -149,10 +143,8 @@ TEMPLATE_DIRS = ( ...@@ -149,10 +143,8 @@ TEMPLATE_DIRS = (
TEMPLATE_CONTEXT_PROCESSORS = ( TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request', 'django.core.context_processors.request',
'django.core.context_processors.static', 'django.core.context_processors.static',
'askbot.context.application_settings',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
#'django.core.context_processors.i18n', #'django.core.context_processors.i18n',
'askbot.user_messages.context_processors.user_messages',#must be before auth
'django.contrib.auth.context_processors.auth', #this is required for admin 'django.contrib.auth.context_processors.auth', #this is required for admin
'django.core.context_processors.csrf', #necessary for csrf protection 'django.core.context_processors.csrf', #necessary for csrf protection
...@@ -229,6 +221,7 @@ MODULESTORE = { ...@@ -229,6 +221,7 @@ MODULESTORE = {
} }
} }
} }
CONTENTSTORE = None
############################ SIGNAL HANDLERS ################################ ############################ SIGNAL HANDLERS ################################
# This is imported to register the exception signal handling that logs exceptions # This is imported to register the exception signal handling that logs exceptions
...@@ -263,7 +256,6 @@ STATIC_ROOT = ENV_ROOT / "staticfiles" ...@@ -263,7 +256,6 @@ STATIC_ROOT = ENV_ROOT / "staticfiles"
STATICFILES_DIRS = [ STATICFILES_DIRS = [
COMMON_ROOT / "static", COMMON_ROOT / "static",
PROJECT_ROOT / "static", PROJECT_ROOT / "static",
PROJECT_ROOT / "askbot" / "skins",
] ]
if os.path.isdir(DATA_DIR): if os.path.isdir(DATA_DIR):
# Add the full course repo if there is no static directory # Add the full course repo if there is no static directory
...@@ -309,35 +301,6 @@ ALLOWED_GITRELOAD_IPS = ['207.97.227.253', '50.57.128.197', '108.171.174.178'] ...@@ -309,35 +301,6 @@ ALLOWED_GITRELOAD_IPS = ['207.97.227.253', '50.57.128.197', '108.171.174.178']
# in the global settings.py # in the global settings.py
AWS_QUERYSTRING_EXPIRE = 10 * 365 * 24 * 60 * 60 # 10 years AWS_QUERYSTRING_EXPIRE = 10 * 365 * 24 * 60 * 60 # 10 years
################################### ASKBOT #####################################
LIVESETTINGS_OPTIONS['MITX_ROOT_URL'] = MITX_ROOT_URL
skin_settings = LIVESETTINGS_OPTIONS[1]['SETTINGS']['GENERAL_SKIN_SETTINGS']
skin_settings['SITE_FAVICON'] = unicode(MITX_ROOT_URL) + skin_settings['SITE_FAVICON']
skin_settings['SITE_LOGO_URL'] = unicode(MITX_ROOT_URL) + skin_settings['SITE_LOGO_URL']
skin_settings['LOCAL_LOGIN_ICON'] = unicode(MITX_ROOT_URL) + skin_settings['LOCAL_LOGIN_ICON']
LIVESETTINGS_OPTIONS[1]['SETTINGS']['LOGIN_PROVIDERS']['WORDPRESS_SITE_ICON'] = unicode(MITX_ROOT_URL) + LIVESETTINGS_OPTIONS[1]['SETTINGS']['LOGIN_PROVIDERS']['WORDPRESS_SITE_ICON']
LIVESETTINGS_OPTIONS[1]['SETTINGS']['LICENSE_SETTINGS']['LICENSE_LOGO_URL'] = unicode(MITX_ROOT_URL) + LIVESETTINGS_OPTIONS[1]['SETTINGS']['LICENSE_SETTINGS']['LICENSE_LOGO_URL']
# ASKBOT_EXTRA_SKINS_DIR = ASKBOT_ROOT / "askbot" / "skins"
ASKBOT_EXTRA_SKINS_DIR = PROJECT_ROOT / "askbot" / "skins"
ASKBOT_ALLOWED_UPLOAD_FILE_TYPES = ('.jpg', '.jpeg', '.gif', '.bmp', '.png', '.tiff')
ASKBOT_MAX_UPLOAD_FILE_SIZE = 1024 * 1024 # result in bytes
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
CACHE_PREFIX = SITE_ID
ASKBOT_URL = 'discussion/'
LOGIN_REDIRECT_URL = MITX_ROOT_URL + '/'
LOGIN_URL = MITX_ROOT_URL + '/'
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 ################################### ################################# SIMPLEWIKI ###################################
SIMPLE_WIKI_REQUIRE_LOGIN_EDIT = True SIMPLE_WIKI_REQUIRE_LOGIN_EDIT = True
SIMPLE_WIKI_REQUIRE_LOGIN_VIEW = False SIMPLE_WIKI_REQUIRE_LOGIN_VIEW = False
...@@ -373,11 +336,11 @@ TEMPLATE_LOADERS = ( ...@@ -373,11 +336,11 @@ TEMPLATE_LOADERS = (
# 'django.template.loaders.filesystem.Loader', # 'django.template.loaders.filesystem.Loader',
# 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.app_directories.Loader',
#'askbot.skins.loaders.filesystem_load_template_source',
# 'django.template.loaders.eggs.Loader', # 'django.template.loaders.eggs.Loader',
) )
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
'contentserver.middleware.StaticContentServer',
'django_comment_client.middleware.AjaxExceptionMiddleware', 'django_comment_client.middleware.AjaxExceptionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
...@@ -393,13 +356,7 @@ MIDDLEWARE_CLASSES = ( ...@@ -393,13 +356,7 @@ MIDDLEWARE_CLASSES = (
'course_wiki.course_nav.Middleware', 'course_wiki.course_nav.Middleware',
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
'askbot.middleware.forum_mode.ForumModeMiddleware',
'askbot.middleware.cancel.CancelActionMiddleware',
'django.middleware.transaction.TransactionMiddleware', 'django.middleware.transaction.TransactionMiddleware',
'askbot.middleware.view_log.ViewLogMiddleware',
'askbot.middleware.spaceless.SpacelessMiddleware',
# 'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
# 'debug_toolbar.middleware.DebugToolbarMiddleware', # 'debug_toolbar.middleware.DebugToolbarMiddleware',
'django_comment_client.utils.ViewNameMiddleware', 'django_comment_client.utils.ViewNameMiddleware',
...@@ -586,16 +543,4 @@ INSTALLED_APPS = ( ...@@ -586,16 +543,4 @@ INSTALLED_APPS = (
# Discussion # Discussion
'django_comment_client', 'django_comment_client',
# For Askbot
'django.contrib.sitemaps',
'django.contrib.admin',
'django_countries',
'djcelery',
'djkombu',
'askbot',
'askbot.deps.livesettings',
'followit',
'keyedcache',
'robots'
) )
...@@ -8,7 +8,7 @@ sessions. Assumes structure: ...@@ -8,7 +8,7 @@ sessions. Assumes structure:
/log # Where we're going to write log files /log # Where we're going to write log files
""" """
from .common import * from .common import *
from .logsettings import get_logger_config from logsettings import get_logger_config
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = True TEMPLATE_DEBUG = True
......
...@@ -14,7 +14,7 @@ if 'eecs1' in socket.gethostname(): ...@@ -14,7 +14,7 @@ if 'eecs1' in socket.gethostname():
MITX_ROOT_URL = '/mitx2' MITX_ROOT_URL = '/mitx2'
from .common import * from .common import *
from .logsettings import get_logger_config from logsettings import get_logger_config
from .dev import * from .dev import *
if 'eecs1' in socket.gethostname(): if 'eecs1' in socket.gethostname():
......
...@@ -8,13 +8,12 @@ sessions. Assumes structure: ...@@ -8,13 +8,12 @@ sessions. Assumes structure:
/log # Where we're going to write log files /log # Where we're going to write log files
""" """
from .common import * from .common import *
from .logsettings import get_logger_config from logsettings import get_logger_config
from .dev import * from .dev import *
import socket import socket
WIKI_ENABLED = False WIKI_ENABLED = False
MITX_FEATURES['ENABLE_TEXTBOOK'] = False MITX_FEATURES['ENABLE_TEXTBOOK'] = False
MITX_FEATURES['ENABLE_DISCUSSION'] = False
MITX_FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = True # require that user be in the staff_* group to be able to enroll MITX_FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = True # require that user be in the staff_* group to be able to enroll
MITX_FEATURES['SUBDOMAIN_COURSE_LISTINGS'] = False MITX_FEATURES['SUBDOMAIN_COURSE_LISTINGS'] = False
MITX_FEATURES['SUBDOMAIN_BRANDING'] = False MITX_FEATURES['SUBDOMAIN_BRANDING'] = False
......
...@@ -8,7 +8,7 @@ sessions. Assumes structure: ...@@ -8,7 +8,7 @@ sessions. Assumes structure:
/log # Where we're going to write log files /log # Where we're going to write log files
""" """
from .common import * from .common import *
from .logsettings import get_logger_config from logsettings import get_logger_config
STATIC_GRAB = True STATIC_GRAB = True
......
...@@ -8,7 +8,7 @@ sessions. Assumes structure: ...@@ -8,7 +8,7 @@ sessions. Assumes structure:
/log # Where we're going to write log files /log # Where we're going to write log files
""" """
from .common import * from .common import *
from .logsettings import get_logger_config from logsettings import get_logger_config
import os import os
from path import path from path import path
......
...@@ -8,7 +8,7 @@ sessions. Assumes structure: ...@@ -8,7 +8,7 @@ sessions. Assumes structure:
/log # Where we're going to write log files /log # Where we're going to write log files
""" """
from .common import * from .common import *
from .logsettings import get_logger_config from logsettings import get_logger_config
import os import os
DEBUG = True DEBUG = True
......
...@@ -219,14 +219,6 @@ if settings.QUICKEDIT: ...@@ -219,14 +219,6 @@ if settings.QUICKEDIT:
urlpatterns += (url(r'^quickedit/(?P<id>[^/]*)$', 'dogfood.views.quickedit'),) urlpatterns += (url(r'^quickedit/(?P<id>[^/]*)$', 'dogfood.views.quickedit'),)
urlpatterns += (url(r'^dogfood/(?P<id>[^/]*)$', 'dogfood.views.df_capa_problem'),) urlpatterns += (url(r'^dogfood/(?P<id>[^/]*)$', 'dogfood.views.df_capa_problem'),)
if settings.ASKBOT_ENABLED:
urlpatterns += (url(r'^%s' % settings.ASKBOT_URL, include('askbot.urls')), \
url(r'^settings/', include('askbot.deps.livesettings.urls')), \
url(r'^followit/', include('followit.urls')), \
# url(r'^robots.txt$', include('robots.urls')),
)
if settings.DEBUG: if settings.DEBUG:
## Jasmine and admin ## Jasmine and admin
......
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