diff --git a/cms/envs/aws.py b/cms/envs/aws.py index 34312eb25b..b44baacb0b 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -3,8 +3,8 @@ This is the default template for our main set of AWS servers. """ import json -from .logsettings import get_logger_config from .common import * +from logsettings import get_logger_config ############################### ALWAYS THE SAME ################################ DEBUG = False @@ -27,6 +27,8 @@ LOG_DIR = ENV_TOKENS['LOG_DIR'] CACHES = ENV_TOKENS['CACHES'] +SESSION_COOKIE_DOMAIN = ENV_TOKENS.get('SESSION_COOKIE_DOMAIN') + for feature, value in ENV_TOKENS.get('MITX_FEATURES', {}).items(): MITX_FEATURES[feature] = value @@ -48,3 +50,4 @@ AWS_ACCESS_KEY_ID = AUTH_TOKENS["AWS_ACCESS_KEY_ID"] AWS_SECRET_ACCESS_KEY = AUTH_TOKENS["AWS_SECRET_ACCESS_KEY"] DATABASES = AUTH_TOKENS['DATABASES'] MODULESTORE = AUTH_TOKENS['MODULESTORE'] +CONTENTSTORE = AUTH_TOKENS['CONTENTSTORE'] diff --git a/cms/envs/dev.py b/cms/envs/dev.py index e5548df2d4..e00c52a13e 100644 --- a/cms/envs/dev.py +++ b/cms/envs/dev.py @@ -2,7 +2,7 @@ This config file runs the simplest dev environment""" from .common import * -from .logsettings import get_logger_config +from logsettings import get_logger_config import logging import sys diff --git a/cms/envs/logsettings.py b/cms/envs/logsettings.py deleted file mode 100644 index 3683314d02..0000000000 --- a/cms/envs/logsettings.py +++ /dev/null @@ -1,96 +0,0 @@ -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 - }, - } - } diff --git a/cms/urls.py b/cms/urls.py index 811d47657f..47db1c024b 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -44,6 +44,8 @@ urlpatterns = ('', # temporary landing page for edge url(r'^edge$', 'contentstore.views.edge', name='edge'), + + url(r'^heartbeat$', include('heartbeat.urls')), ) # User creation and updating views diff --git a/lms/djangoapps/heartbeat/__init__.py b/common/djangoapps/heartbeat/__init__.py similarity index 100% rename from lms/djangoapps/heartbeat/__init__.py rename to common/djangoapps/heartbeat/__init__.py diff --git a/lms/djangoapps/heartbeat/urls.py b/common/djangoapps/heartbeat/urls.py similarity index 100% rename from lms/djangoapps/heartbeat/urls.py rename to common/djangoapps/heartbeat/urls.py diff --git a/lms/djangoapps/heartbeat/views.py b/common/djangoapps/heartbeat/views.py similarity index 100% rename from lms/djangoapps/heartbeat/views.py rename to common/djangoapps/heartbeat/views.py diff --git a/lms/envs/logsettings.py b/common/lib/logsettings.py similarity index 100% rename from lms/envs/logsettings.py rename to common/lib/logsettings.py diff --git a/common/lib/xmodule/xmodule/contentstore/mongo.py b/common/lib/xmodule/xmodule/contentstore/mongo.py index b5235e6745..9a99006e61 100644 --- a/common/lib/xmodule/xmodule/contentstore/mongo.py +++ b/common/lib/xmodule/xmodule/contentstore/mongo.py @@ -14,9 +14,13 @@ from xmodule.exceptions import NotFoundError 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)) - _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_files = _db["fs.files"] # the underlying collection GridFS uses diff --git a/common/lib/xmodule/xmodule/modulestore/mongo.py b/common/lib/xmodule/xmodule/modulestore/mongo.py index 30ae5c7539..164bfd3590 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo.py @@ -97,15 +97,21 @@ class MongoModuleStore(ModuleStoreBase): # TODO (cpennington): Enable non-filesystem filestores def __init__(self, host, db, collection, fs_root, render_template, port=27017, default_class=None, - error_tracker=null_error_tracker): + error_tracker=null_error_tracker, + user=None, password=None, **kwargs): ModuleStoreBase.__init__(self) self.collection = pymongo.connection.Connection( host=host, - port=port + port=port, + **kwargs )[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 self.collection.safe = True diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index e5405c7f4a..3309f6270c 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -409,7 +409,7 @@ class XModuleDescriptor(Plugin, HTMLSnippet, ResourceTemplates): # cdodge: this is a list of metadata names which are 'system' metadata # 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 # be equal diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index e97622a5ef..5abdc93604 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -220,9 +220,6 @@ def get_default_tabs(user, course, active_page): link = reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id]) 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)) diff --git a/lms/envs/askbotsettings.py b/lms/envs/askbotsettings.py deleted file mode 100644 index eb4840a157..0000000000 --- a/lms/envs/askbotsettings.py +++ /dev/null @@ -1,293 +0,0 @@ -""" -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\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, - }, - }, - }, -} diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 08150c9acd..8794cb0581 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -8,8 +8,8 @@ Common traits: """ import json -from .logsettings import get_logger_config from .common import * +from logsettings import get_logger_config ############################### ALWAYS THE SAME ################################ DEBUG = False @@ -20,7 +20,6 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.cache' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' # Disable askbot, enable Berkeley forums -MITX_FEATURES['ENABLE_DISCUSSION'] = False MITX_FEATURES['ENABLE_DISCUSSION_SERVICE'] = True # 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: ENV_TOKENS = json.load(env_file) SITE_NAME = ENV_TOKENS['SITE_NAME'] +SESSION_COOKIE_DOMAIN = ENV_TOKENS.get('SESSION_COOKIE_DOMAIN') BOOK_URL = ENV_TOKENS['BOOK_URL'] MEDIA_URL = ENV_TOKENS['MEDIA_URL'] @@ -76,6 +76,11 @@ DATABASES = AUTH_TOKENS['DATABASES'] 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: ASKBOT_URL = "courses/{0}/discussions/".format(ENV_TOKENS['COURSE_ID']) diff --git a/lms/envs/cms/aws.py b/lms/envs/cms/aws.py index b807a0f545..a0e2f25d83 100644 --- a/lms/envs/cms/aws.py +++ b/lms/envs/cms/aws.py @@ -2,7 +2,7 @@ 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: CMS_AUTH_TOKENS = json.load(auth_file) diff --git a/lms/envs/cms/dev.py b/lms/envs/cms/dev.py index f436c8e8cc..ded3471ea2 100644 --- a/lms/envs/cms/dev.py +++ b/lms/envs/cms/dev.py @@ -19,3 +19,11 @@ MODULESTORE = { 'OPTIONS': modulestore_options }, } + +CONTENTSTORE = { + 'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore', + 'OPTIONS': { + 'host': 'localhost', + 'db' : 'xcontent', + } +} diff --git a/lms/envs/common.py b/lms/envs/common.py index 3bcf0931d4..8555da5058 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -26,12 +26,10 @@ from xmodule.static_content import write_module_styles, write_module_js import djcelery from path import path -from .askbotsettings import * # this is where LIVESETTINGS_OPTIONS comes from from .discussionsettings import * ################################### FEATURES ################################### COURSEWARE_ENABLED = True -ASKBOT_ENABLED = False GENERATE_RANDOM_USER_CREDENTIALS = False PERFSTATS = False @@ -65,7 +63,6 @@ MITX_FEATURES = { # set to None to do no university selection 'ENABLE_TEXTBOOK' : True, - 'ENABLE_DISCUSSION' : False, 'ENABLE_DISCUSSION_SERVICE': True, '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 REPO_ROOT = PROJECT_ROOT.dirname() COMMON_ROOT = REPO_ROOT / "common" ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /mitx is in -ASKBOT_ROOT = REPO_ROOT / "askbot" COURSES_ROOT = ENV_ROOT / "data" # FIXME: To support multiple courses, we should walk the courses dir at startup DATA_DIR = COURSES_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 / 'lib') sys.path.append(COMMON_ROOT / 'djangoapps') @@ -149,10 +143,8 @@ TEMPLATE_DIRS = ( TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', 'django.core.context_processors.static', - 'askbot.context.application_settings', 'django.contrib.messages.context_processors.messages', #'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.core.context_processors.csrf', #necessary for csrf protection @@ -229,6 +221,7 @@ MODULESTORE = { } } } +CONTENTSTORE = None ############################ SIGNAL HANDLERS ################################ # This is imported to register the exception signal handling that logs exceptions @@ -263,7 +256,6 @@ STATIC_ROOT = ENV_ROOT / "staticfiles" STATICFILES_DIRS = [ COMMON_ROOT / "static", PROJECT_ROOT / "static", - PROJECT_ROOT / "askbot" / "skins", ] if os.path.isdir(DATA_DIR): # 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'] # in the global settings.py 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 ################################### SIMPLE_WIKI_REQUIRE_LOGIN_EDIT = True SIMPLE_WIKI_REQUIRE_LOGIN_VIEW = False @@ -373,11 +336,11 @@ 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 = ( + 'contentserver.middleware.StaticContentServer', 'django_comment_client.middleware.AjaxExceptionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -393,13 +356,7 @@ MIDDLEWARE_CLASSES = ( 'course_wiki.course_nav.Middleware', - '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', # 'debug_toolbar.middleware.DebugToolbarMiddleware', 'django_comment_client.utils.ViewNameMiddleware', @@ -586,16 +543,4 @@ INSTALLED_APPS = ( # Discussion 'django_comment_client', - - # For Askbot - 'django.contrib.sitemaps', - 'django.contrib.admin', - 'django_countries', - 'djcelery', - 'djkombu', - 'askbot', - 'askbot.deps.livesettings', - 'followit', - 'keyedcache', - 'robots' ) diff --git a/lms/envs/dev.py b/lms/envs/dev.py index 9114f099d4..b89b0246f3 100644 --- a/lms/envs/dev.py +++ b/lms/envs/dev.py @@ -8,7 +8,7 @@ sessions. Assumes structure: /log # Where we're going to write log files """ from .common import * -from .logsettings import get_logger_config +from logsettings import get_logger_config DEBUG = True TEMPLATE_DEBUG = True diff --git a/lms/envs/dev_edx4edx.py b/lms/envs/dev_edx4edx.py index dda08a000d..0212d8b550 100644 --- a/lms/envs/dev_edx4edx.py +++ b/lms/envs/dev_edx4edx.py @@ -14,7 +14,7 @@ if 'eecs1' in socket.gethostname(): MITX_ROOT_URL = '/mitx2' from .common import * -from .logsettings import get_logger_config +from logsettings import get_logger_config from .dev import * if 'eecs1' in socket.gethostname(): diff --git a/lms/envs/dev_ike.py b/lms/envs/dev_ike.py index 0be9146fd4..7e0e0f001c 100644 --- a/lms/envs/dev_ike.py +++ b/lms/envs/dev_ike.py @@ -8,13 +8,12 @@ sessions. Assumes structure: /log # Where we're going to write log files """ from .common import * -from .logsettings import get_logger_config +from logsettings import get_logger_config from .dev import * import socket WIKI_ENABLED = 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['SUBDOMAIN_COURSE_LISTINGS'] = False MITX_FEATURES['SUBDOMAIN_BRANDING'] = False diff --git a/lms/envs/static.py b/lms/envs/static.py index 179f9160c5..16a668911b 100644 --- a/lms/envs/static.py +++ b/lms/envs/static.py @@ -8,7 +8,7 @@ sessions. Assumes structure: /log # Where we're going to write log files """ from .common import * -from .logsettings import get_logger_config +from logsettings import get_logger_config STATIC_GRAB = True diff --git a/lms/envs/test.py b/lms/envs/test.py index 34108256e9..d1cc10f4d5 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -8,7 +8,7 @@ sessions. Assumes structure: /log # Where we're going to write log files """ from .common import * -from .logsettings import get_logger_config +from logsettings import get_logger_config import os from path import path diff --git a/lms/envs/test_ike.py b/lms/envs/test_ike.py index 8bdecb3c8f..d0169c5043 100644 --- a/lms/envs/test_ike.py +++ b/lms/envs/test_ike.py @@ -8,7 +8,7 @@ sessions. Assumes structure: /log # Where we're going to write log files """ from .common import * -from .logsettings import get_logger_config +from logsettings import get_logger_config import os DEBUG = True diff --git a/lms/urls.py b/lms/urls.py index 662e41235e..a5c06ad979 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -219,14 +219,6 @@ if settings.QUICKEDIT: urlpatterns += (url(r'^quickedit/(?P[^/]*)$', 'dogfood.views.quickedit'),) urlpatterns += (url(r'^dogfood/(?P[^/]*)$', '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: ## Jasmine and admin