<commit_before>"""
These are the django settings for the Seattle Clearinghouse project. See the README.txt
file for details on what needs to be set in this file. At a minimum for
development, it will be the database connection info and the SECRET_KEY value.

For public deployment, see the README.txt file for information about which
additional changes you'll need to make to this file.
"""

import os


from seattlegeni.common.util import log



# If DEBUG is True, then error details will be shown on the website and ADMINS
# will not receive an email when an error occurs. So, this should be False in
# production.
DEBUG = True
TEMPLATE_DEBUG = DEBUG

# The log level used by the seattlegeni log module. All messages at this level
# or more severe will be logged.
SEATTLECLEARINGHOUSE_LOG_LEVEL = log.LOG_LEVEL_DEBUG

# Rather than make the log module have to import this settings file to set the
# log level, just set it right here.
log.set_log_level(SEATTLECLEARINGHOUSE_LOG_LEVEL)

# This is needed to allow xmlrpc requests to work when they don't have a slash
# on the end of the url.
APPEND_SLASH = False

# The directory the settings.py file is in is what we consider the root of the website. 
SEATTLECLEARINGHOUSE_WEBSITE_ROOT = os.path.dirname(__file__)

# The directory where we keep the public keys of the node state keys.
SEATTLECLEARINGHOUSE_STATE_KEYS_DIR = os.path.join(SEATTLECLEARINGHOUSE_WEBSITE_ROOT, '..', 'node_state_transitions', 'statekeys')

# The XML-RPC interface to the Custom Installer Builder.
SEATTLECLEARINGHOUSE_INSTALLER_BUILDER_XMLRPC = "https://custombuilder.poly.edu/custom_install/xmlrpc/"

# Not currently used. This is left in for legacy installs
# The directory where the base installers named seattle_linux.tgz, seattle_mac.tgz,
# and seattle_win.zip are located.
#SEATTLECLEARINGHOUSE_BASE_INSTALLERS_DIR = "/var/www/dist"

# Not currently used. This is left in for legacy installs
# The directory in which customized installers created by seattlegeni will be
# stored. A directory within this directory will be created for each user.
#SEATTLECLEARINGHOUSE_USER_INSTALLERS_DIR = os.path.join(SEATTLECLEARINGHOUSE_BASE_INSTALLERS_DIR, "geni")

# Not currently used. This is left in for legacy installs
#The url that corresponds to SEATTLECLEARINGHOUSE_USER_INSTALLERS_DIR
#SEATTLECLEARINGHOUSE_USER_INSTALLERS_URL = "https://blackbox.cs.washington.edu/dist/geni"

# Need to specify the LOGIN_URL, as our login page isn't at the default login
# location (the default is /accounts/login).
LOGIN_URL = 'login'

# Users will be redirected to SOCIAL_AUTH_LOGIN_ERROR_URL in case of backend error/user cancellation
# during login or association (account linking).
SOCIAL_AUTH_LOGIN_ERROR_URL ='error'
SOCIAL_AUTH_BACKEND_ERROR_URL = 'error'

# When a user logs in with OpenID/OAuth send them to the profile page
SOCIAL_AUTH_LOGIN_REDIRECT_URL = 'profile'

# A new user created through OpenID/OAuth gets sent here upon creation. 
# currently not used
#SOCIAL_AUTH_NEW_USER_REDIRECT_URL = 'new_auto_register_user'

# fields specificed here will not be automatically changed/updated by social_auth
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['email',]

# Email addresses of people that should be emailed when a 500 error occurs on
# the site when DEBUG = False (that is, in production). Leave this to be empty
# if nobody should receive an email. 
ADMINS = (
    # ('<NAME>', '<EMAIL>'),
)

# To be able to send mail to ADMINS when there is an error, django needs to
# know about an SMTP server it can use. That info is defined here.
#EMAIL_HOST = 'smtp.gmail.com'
#EMAIL_HOST_USER = '<EMAIL>'
#EMAIL_HOST_PASSWORD = '<PASSWORD>'
#EMAIL_PORT = 587
#EMAIL_USE_TLS = True

# Email address that error notifications will be sent from.
#SERVER_EMAIL = "<EMAIL>"

# We use this so we know which server the email came from by the subject line.
#EMAIL_SUBJECT_PREFIX = "[localhost] "

MANAGERS = ADMINS

# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
    'default': {
        # you can use django.db.backends.sqlite3 instead of mysql. If you
        # decide to do so, you can leave the other fields empty
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'FILL_THIS_IN',
        'USER': 'FILL_THIS_IN',
        'PASSWORD': '<PASSWORD>',
        'HOST': '',
        'PORT': '',
    }
}

if DATABASES['default']['ENGINE'] == 'django.db.backends.mysql':
    DATABASES['default']['OPTIONS'] = {}
    DATABASES['default']['OPTIONS']['init_command'] = \
            'SET storage_engine=INNODB'

# Make this unique, and don't share it with anybody.
# Fill this in!
SECRET_KEY = ''

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Los_Angeles'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

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

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = SEATTLECLEARINGHOUSE_WEBSITE_ROOT + '/html/media/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/site_media/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/admin_media/'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
  'django.template.loaders.filesystem.load_template_source',
  'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
  'django.middleware.common.CommonMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.middleware.sessions.SessionMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  'django.middleware.clickjacking.XFrameOptionsMiddleware',
  #'django.middleware.doc.XViewMiddleware',

  # Our own middleware that logs when a request is initially received and
  # sets up the logger to log other messages with per-request unique ids.
  'seattlegeni.website.middleware.logrequest.LogRequestMiddleware',
  # Our own middleware that logs when unhandled exceptions happen.
  'seattlegeni.website.middleware.logexception.LogExceptionMiddleware',

)

ROOT_URLCONF = 'seattlegeni.website.urls'

TEMPLATE_DIRS = (
  # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  # Always use forward slashes, even on Windows.
  # Don't forget to use absolute paths, not relative paths.
  SEATTLECLEARINGHOUSE_WEBSITE_ROOT + '/html/templates'
)

INSTALLED_APPS = (
  'django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.sites',
  'django.contrib.messages',<commit_msg>Updated the location of session middleware<commit_after>"""
These are the django settings for the Seattle Clearinghouse project. See the README.txt
file for details on what needs to be set in this file. At a minimum for
development, it will be the database connection info and the SECRET_KEY value.

For public deployment, see the README.txt file for information about which
additional changes you'll need to make to this file.
"""

import os


from seattlegeni.common.util import log



# If DEBUG is True, then error details will be shown on the website and ADMINS
# will not receive an email when an error occurs. So, this should be False in
# production.
DEBUG = True
TEMPLATE_DEBUG = DEBUG

# The log level used by the seattlegeni log module. All messages at this level
# or more severe will be logged.
SEATTLECLEARINGHOUSE_LOG_LEVEL = log.LOG_LEVEL_DEBUG

# Rather than make the log module have to import this settings file to set the
# log level, just set it right here.
log.set_log_level(SEATTLECLEARINGHOUSE_LOG_LEVEL)

# This is needed to allow xmlrpc requests to work when they don't have a slash
# on the end of the url.
APPEND_SLASH = False

# The directory the settings.py file is in is what we consider the root of the website. 
SEATTLECLEARINGHOUSE_WEBSITE_ROOT = os.path.dirname(__file__)

# The directory where we keep the public keys of the node state keys.
SEATTLECLEARINGHOUSE_STATE_KEYS_DIR = os.path.join(SEATTLECLEARINGHOUSE_WEBSITE_ROOT, '..', 'node_state_transitions', 'statekeys')

# The XML-RPC interface to the Custom Installer Builder.
SEATTLECLEARINGHOUSE_INSTALLER_BUILDER_XMLRPC = "https://custombuilder.poly.edu/custom_install/xmlrpc/"

# Not currently used. This is left in for legacy installs
# The directory where the base installers named seattle_linux.tgz, seattle_mac.tgz,
# and seattle_win.zip are located.
#SEATTLECLEARINGHOUSE_BASE_INSTALLERS_DIR = "/var/www/dist"

# Not currently used. This is left in for legacy installs
# The directory in which customized installers created by seattlegeni will be
# stored. A directory within this directory will be created for each user.
#SEATTLECLEARINGHOUSE_USER_INSTALLERS_DIR = os.path.join(SEATTLECLEARINGHOUSE_BASE_INSTALLERS_DIR, "geni")

# Not currently used. This is left in for legacy installs
#The url that corresponds to SEATTLECLEARINGHOUSE_USER_INSTALLERS_DIR
#SEATTLECLEARINGHOUSE_USER_INSTALLERS_URL = "https://blackbox.cs.washington.edu/dist/geni"

# Need to specify the LOGIN_URL, as our login page isn't at the default login
# location (the default is /accounts/login).
LOGIN_URL = 'login'

# Users will be redirected to SOCIAL_AUTH_LOGIN_ERROR_URL in case of backend error/user cancellation
# during login or association (account linking).
SOCIAL_AUTH_LOGIN_ERROR_URL ='error'
SOCIAL_AUTH_BACKEND_ERROR_URL = 'error'

# When a user logs in with OpenID/OAuth send them to the profile page
SOCIAL_AUTH_LOGIN_REDIRECT_URL = 'profile'

# A new user created through OpenID/OAuth gets sent here upon creation. 
# currently not used
#SOCIAL_AUTH_NEW_USER_REDIRECT_URL = 'new_auto_register_user'

# fields specificed here will not be automatically changed/updated by social_auth
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['email',]

# Email addresses of people that should be emailed when a 500 error occurs on
# the site when DEBUG = False (that is, in production). Leave this to be empty
# if nobody should receive an email. 
ADMINS = (
    # ('<NAME>', '<EMAIL>'),
)

# To be able to send mail to ADMINS when there is an error, django needs to
# know about an SMTP server it can use. That info is defined here.
#EMAIL_HOST = 'smtp.gmail.com'
#EMAIL_HOST_USER = '<EMAIL>'
#EMAIL_HOST_PASSWORD = '<PASSWORD>'
#EMAIL_PORT = 587
#EMAIL_USE_TLS = True

# Email address that error notifications will be sent from.
#SERVER_EMAIL = "<EMAIL>"

# We use this so we know which server the email came from by the subject line.
#EMAIL_SUBJECT_PREFIX = "[localhost] "

MANAGERS = ADMINS

# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
    'default': {
        # you can use django.db.backends.sqlite3 instead of mysql. If you
        # decide to do so, you can leave the other fields empty
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'FILL_THIS_IN',
        'USER': 'FILL_THIS_IN',
        'PASSWORD': '<PASSWORD>',
        'HOST': '',
        'PORT': '',
    }
}

if DATABASES['default']['ENGINE'] == 'django.db.backends.mysql':
    DATABASES['default']['OPTIONS'] = {}
    DATABASES['default']['OPTIONS']['init_command'] = \
            'SET storage_engine=INNODB'

# Make this unique, and don't share it with anybody.
# Fill this in!
SECRET_KEY = ''

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Los_Angeles'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

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

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = SEATTLECLEARINGHOUSE_WEBSITE_ROOT + '/html/media/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/site_media/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/admin_media/'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
  'django.template.loaders.filesystem.load_template_source',
  'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
  'django.middleware.common.CommonMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.sessions.middleware.SessionMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  'django.middleware.clickjacking.XFrameOptionsMiddleware',
  #'django.middleware.doc.XViewMiddleware',

  # Our own middleware that logs when a request is initially received and
  # sets up the logger to log other messages with per-request unique ids.
  'seattlegeni.website.middleware.logrequest.LogRequestMiddleware',
  # Our own middleware that logs when unhandled exceptions happen.
  'seattlegeni.website.middleware.logexception.LogExceptionMiddleware',

)

ROOT_URLCONF = 'seattlegeni.website.urls'

TEMPLATE_DIRS = (
  # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  # Always use forward slashes, even on Windows.
  # Don't forget to use absolute paths, not relative paths.
  SEATTLECLEARINGHOUSE_WEBSITE_ROOT + '/html/templates'
)

INSTALLED_APPS = (
  'django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.sites',
  'django.contrib.messages',
{'fraction_non_alphanumeric': 0.08771457421743521, 'fraction_numerical': 0.0018848872433524066, 'mean_word_length': 4.591268347760632, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 6, 'lorem ipsum': 0, 'www.': 6, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '616285', 'n_tokens_mistral': 4669, 'n_tokens_neox': 4582, 'n_words': 1564}