Skip to content
Snippets Groups Projects
common.py 38.6 KiB
Newer Older
    'eventtracking.django',
Carson Gee's avatar
Carson Gee committed
    'dashboard',
    'instructor_task',
    'open_ended_grading',
    # External auth (OpenID, shib)
    'external_auth',
    'django_openid_auth',

    'wiki',  # The new django-wiki from benjaoming
    'course_wiki',  # Our customizations
    #'wiki.plugins.attachments',
    'course_wiki.plugins.markdownedx',
    # Foldit integration
Victor Shnayder's avatar
Victor Shnayder committed
    'foldit',

    'django.contrib.admin',  # only used in DEBUG mode
    # Discussion forums
    'django_comment_client',
    # User API
    'rest_framework',
    'user_api',
    # Notification preferences setting
    'notification_prefs',

    # Different Course Modes

    # Student Identity Verification
    'verify_student',

    # Dark-launching languages
    'dark_lang',
######################### MARKETING SITE ###############################
EDXMKTG_COOKIE_NAME = 'edxloggedin'
MKTG_URLS = {}
MKTG_URL_LINK_MAP = {
    'ABOUT': 'about_edx',
    'CONTACT': 'contact',
    'FAQ': 'help_edx',
    'COURSES': 'courses',
    'ROOT': 'root',
    'TOS': 'tos',
    'HONOR': 'honor',
    'PRIVACY': 'privacy_edx',
    'JOBS': 'jobs',
    'PRESS': 'press',

    # Verified Certificates
    'WHAT_IS_VERIFIED_CERT': 'verified-certificate',
############################### MICROSITES ################################
def enable_microsites(microsite_config_dict, subdomain_branding, virtual_universities, microsites_root=ENV_ROOT / "microsites"):
    """
    Enable the use of microsites, which are websites that allow
    for subdomains for the edX platform, e.g. foo.edx.org
    """

    if not microsite_config_dict:
        return

    FEATURES['USE_MICROSITES'] = True

    for microsite_name in microsite_config_dict.keys():
        # Calculate the location of the microsite's files
        microsite_root = microsites_root / microsite_name
        microsite_config = microsite_config_dict[microsite_name]

        # pull in configuration information from each
        # microsite root

        if os.path.isdir(microsite_root):
            # store the path on disk for later use
            microsite_config['microsite_root'] = microsite_root

            # get the domain that this should reside
            domain = microsite_config['domain_prefix']

            # get the virtual university that this should use
            university = microsite_config['university']

            # add to the existing maps in our settings
            subdomain_branding[domain] = university
            virtual_universities.append(university)

            template_dir = microsite_root / 'templates'
            microsite_config['template_dir'] = template_dir

            microsite_config['microsite_name'] = microsite_name

        else:
            # not sure if we have application logging at this stage of
            # startup
            print '**** Error loading microsite {0}. Directory does not exist'.format(microsite_root)
            # remove from our configuration as it is not valid
            del microsite_config_dict[microsite_name]

    # if we have microsites, then let's turn on SUBDOMAIN_BRANDING
    # Note check size of the dict because some microsites might not be found on disk and
    # we could be left with none
    if microsite_config_dict:
        FEATURES['SUBDOMAIN_BRANDING'] = True

        TEMPLATE_DIRS.append(microsites_root)
        MAKO_TEMPLATES['main'].append(microsites_root)

        STATICFILES_DIRS.append(microsites_root)


################# Student Verification #################
VERIFY_STUDENT = {
    "DAYS_GOOD_FOR": 365,  # How many days is a verficiation good for?
######################## CAS authentication ###########################

if FEATURES.get('AUTH_USE_CAS'):
    CAS_SERVER_URL = 'https://provide_your_cas_url_here'
    AUTHENTICATION_BACKENDS = (
        'django.contrib.auth.backends.ModelBackend',
        'django_cas.backends.CASBackend',
    INSTALLED_APPS += ('django_cas',)
    MIDDLEWARE_CLASSES += ('django_cas.middleware.CASMiddleware',)

###################### Registration ##################################

# For each of the fields, give one of the following values:
# - 'required': to display the field, and make it mandatory
# - 'optional': to display the field, and make it non-mandatory
# - 'hidden': to not display the field

REGISTRATION_EXTRA_FIELDS = {
    'level_of_education': 'optional',
    'gender': 'optional',
    'year_of_birth': 'optional',
    'mailing_address': 'optional',
    'goals': 'optional',
    'honor_code': 'required',
    'city': 'hidden',
    'country': 'hidden',
}
###################### Grade Downloads ######################
GRADES_DOWNLOAD_ROUTING_KEY = HIGH_MEM_QUEUE

GRADES_DOWNLOAD = {
    'STORAGE_TYPE': 'localfs',
    'BUCKET': 'edx-grades',
    'ROOT_PATH': '/tmp/edx-s3/grades',

##################### LinkedIn #####################
INSTALLED_APPS += ('django_openid_auth',)


############################ LinkedIn Integration #############################
INSTALLED_APPS += ('linkedin',)
LINKEDIN_API = {
    'EMAIL_WHITELIST': [],
    'COMPANY_ID': '2746406',
}