settings.py 4.41 KB
Newer Older
1 2
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
Jean Michel Rouly's avatar
Jean Michel Rouly committed
3

4 5
TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, 'templates'),
6 7 8
    os.path.join(BASE_DIR, 'trades/templates'),
    os.path.join(BASE_DIR, 'core/templates'),
    os.path.join(BASE_DIR, 'lookouts/templates'),
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
)

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'django.contrib.messages.context_processors.messages',
    'django.core.context_processors.request',
)

INSTALLED_APPS = (
    'django.contrib.admin',
Daniel W Bond's avatar
Daniel W Bond committed
28
    'django.contrib.admindocs',
29 30 31 32 33 34
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
35
    'django.contrib.humanize',
Daniel W Bond's avatar
Daniel W Bond committed
36
    # apps
37 38
    'trades',
    'core',
39
    'lookouts',
40
    'mod',
Daniel W Bond's avatar
Daniel W Bond committed
41 42
    # packages
    'randomslugfield',
43
    'django_gravatar',
Daniel W Bond's avatar
Daniel W Bond committed
44
    'crispy_forms',
Daniel W Bond's avatar
Daniel W Bond committed
45
    'haystack',
46
    'piwik',
47
    'storages',
48 49
)

50
CRISPY_TEMPLATE_PACK = 'bootstrap3'
Daniel W Bond's avatar
Daniel W Bond committed
51

52 53 54 55
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
Daniel W Bond's avatar
Daniel W Bond committed
56
    'cas.middleware.CASMiddleware',
57 58 59 60 61 62 63 64 65 66
    'django.middleware.doc.XViewMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'settings.urls'

WSGI_APPLICATION = 'settings.wsgi.application'

Jean Michel Rouly's avatar
Jean Michel Rouly committed
67
DEBUG = True
Jean Michel Rouly's avatar
Jean Michel Rouly committed
68 69 70 71 72
TEMPLATE_DEBUG = DEBUG
ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
Daniel W Bond's avatar
Daniel W Bond committed
73
ORGANIZATION_EMAIL_DOMAIN = 'masonlive.gmu.edu'
Jean Michel Rouly's avatar
Jean Michel Rouly committed
74

75 76 77
import secret
SECRET_KEY = secret.SECRET_KEY

Jean Michel Rouly's avatar
Jean Michel Rouly committed
78 79
DATABASES = {
    'default': {
80
        'ENGINE': 'django.db.backends.mysql',
81 82 83 84
        'NAME': secret.DB_NAME,
        'USER': secret.DB_USER,
        'PASSWORD': secret.DB_PASSWORD,
        'HOST': secret.DB_HOST,
85
        'PORT': secret.DB_PORT,
Jean Michel Rouly's avatar
Jean Michel Rouly committed
86 87 88 89 90 91 92
    }
}

LANGUAGE_CODE = 'en-us'

SITE_ID = 1

93 94 95 96
TIME_ZONE = 'America/New_York'

ALLOWED_HOSTS = ['127.0.0.1']

Jean Michel Rouly's avatar
Jean Michel Rouly committed
97 98 99 100 101 102
USE_I18N = True

USE_L10N = True

USE_TZ = True

Daniel W Bond's avatar
Daniel W Bond committed
103 104
TEST_RUNNER = 'django.test.runner.DiscoverRunner'

105
STATIC_URL = '/static/'
106 107 108
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)
109

110 111
AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
Daniel W Bond's avatar
Daniel W Bond committed
112
    'cas.backends.CASBackend',
113 114
)

Daniel W Bond's avatar
Daniel W Bond committed
115 116 117
CAS_SERVER_URL = 'https://login.gmu.edu'
CAS_LOGOUT_COMPLETELY = True
CAS_PROVIDE_URL_TO_LOGOUT = True
118 119
#LOGIN_URL = '/login/'
#LOGOUT_URL = '/logout/'
120

Daniel W Bond's avatar
Daniel W Bond committed
121
CAS_RESPONSE_CALLBACKS = (
122
    'core.cas_callbacks.create_user',
Daniel W Bond's avatar
Daniel W Bond committed
123
)
Daniel W Bond's avatar
Daniel W Bond committed
124 125

HAYSTACK_CONNECTIONS = {
Daniel W Bond's avatar
Daniel W Bond committed
126 127 128
    'default': {
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
        'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
Daniel W Bond's avatar
Daniel W Bond committed
129 130 131
    },
}

132 133 134
# Haystack Signal Processor
# The RealtimeSignalProcessor allows for objects to be indexed as soon as
# they are created --- in real time.
Daniel W Bond's avatar
Daniel W Bond committed
135
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
136 137 138 139

# Piwik configurations
PIWIK_SITE_ID = secret.PIWIK_SITE_ID
PIWIK_URL = secret.PIWIK_URL
140 141 142 143 144 145 146

# Email configurations
EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend'
EMAIL_HOST = secret.EMAIL_HOST
EMAIL_PORT = '465'
EMAIL_HOST_USER = secret.EMAIL_HOST_USER
EMAIL_HOST_PASSWORD = secret.EMAIL_HOST_PASSWORD
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166

# Media configurations
MEDIA_S3 = False

if MEDIA_S3:

    AWS_HEADERS = {  # see http://developer.yahoo.com/performance/rules.html#expires
        'Expires': 'Thu, 31 Dec 2099 20:00:00 GMT',
        'Cache-Control': 'max-age=94608000',
    }

    AWS_STORAGE_BUCKET_NAME = secret.AWS_STORAGE_BUCKET_NAME
    AWS_ACCESS_KEY_ID = secret.AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY = secret.AWS_SECRET_ACCESS_KEY
    AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
    MEDIA_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN
    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
else:
    MEDIA_URL = '/media/'
    MEDIA_ROOT = (os.path.join(BASE_DIR, 'media'))
167 168 169 170 171 172 173 174 175 176 177

# don't use redis when in develoment
if DEBUG:
    pass
else:
    CACHES = {
        'default': {
            'BACKEND': 'redis_cache.RedisCache',
            'LOCATION': '/var/run/redis/redis.sock',
        },
    }