settings.py 4.52 KB
Newer Older
1
"""
2
Django settings for roomlist project.
3
4

For more information on this file, see
5
https://docs.djangoproject.com/en/1.7/topics/settings/
6
7

For the full list of settings and their values, see
8
https://docs.djangoproject.com/en/1.7/ref/settings/
9
10
11
12
13
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
14

15
16
ORGANIZATION_EMAIL_DOMAIN = 'masonlive.gmu.edu'

17
18
19
TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, 'templates'),
    os.path.join(BASE_DIR, 'housing/templates'),
20
    os.path.join(BASE_DIR, 'accounts/templates'),
21
22
)

23
24
25
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)
26
27
28
29
30
31
32
33
34
35

print TEMPLATE_DIRS

TEMPLATE_LOADERS = (

    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',

)

36
37
38
39
40
41
42
43
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',
Jason D Yeomans's avatar
Jason D Yeomans committed
44
45
    'allauth.account.context_processors.account',
    'allauth.socialaccount.context_processors.socialaccount',
46
)
47
# Quick-start development settings - unsuitable for production
48
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
49

50
51
52
53
import config
DEBUG = config.DEBUG
TEMPLATE_DEBUG = config.TEMPLATE_DEBUG
ALLOWED_HOSTS = config.ALLOWED_HOSTS
54

Daniel W Bond's avatar
Daniel W Bond committed
55
56
57
PIWIK_DOMAIN_PATH = config.PIWIK_DOMAIN_PATH
PIWIK_SITE_ID = config.PIWIK_SITE_ID

58
59
60
61
62
63
64
65
66
# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
Jason D Yeomans's avatar
Jason D Yeomans committed
67
    'django.contrib.sites',
68
    'django.contrib.humanize',
Daniel W Bond's avatar
Daniel W Bond committed
69
    # apps
70
    'api',
71
    'housing',
72
    'accounts',
Daniel W Bond's avatar
Daniel W Bond committed
73
    # packages
74
75
    'crispy_forms',
    'django_gravatar',
Daniel W Bond's avatar
Daniel W Bond committed
76
    'analytical',
77
    'randomslugfield',
Daniel W Bond's avatar
Daniel W Bond committed
78
    'haystack',
79
    'multiselectfield',
Jason D Yeomans's avatar
Jason D Yeomans committed
80
81
82
83
84
85
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.facebook',
    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.twitter',
86
    'allauth.socialaccount.providers.instagram',
87
88
)

89
90
CRISPY_TEMPLATE_PACK = 'bootstrap'

91
92
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
93
    'django.contrib.sessions.middleware.SessionMiddleware',
94
    'django.contrib.auth.middleware.AuthenticationMiddleware',
Daniel W Bond's avatar
Daniel W Bond committed
95
    'cas.middleware.CASMiddleware',
96
97
98
    'django.middleware.doc.XViewMiddleware',

    'django.middleware.csrf.CsrfViewMiddleware',
99
100
101
102
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

103
ROOT_URLCONF = 'settings.urls'
104

105
WSGI_APPLICATION = 'settings.wsgi.application'
106

107
import secret
108
# Database
109
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
110

111
112
SECRET_KEY = secret.SECRET_KEY

113
114
115
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
116
117
118
119
120
        'NAME': secret.DB_NAME,
        'USER': secret.DB_USER,
        'PASSWORD': secret.DB_PASSWORD,
        'HOST': secret.DB_HOST,
        'PORT': secret.DB_PORT,
121
122
123
124
    }
}

# Internationalization
125
# https://docs.djangoproject.com/en/1.7/topics/i18n/
126
127
128

LANGUAGE_CODE = 'en-us'

129
TIME_ZONE = 'America/New_York'
130
131
132
133
134
135
136

USE_I18N = True

USE_L10N = True

USE_TZ = True

137
# set for social auth
Daniel W Bond's avatar
Daniel W Bond committed
138
SITE_ID = 1
Daniel W Bond's avatar
Daniel W Bond committed
139

140
# Static files (CSS, JavaScript, Images)
141
# https://docs.djangoproject.com/en/1.7/howto/static-files/
142
143

STATIC_URL = '/static/'
144

145
146
ACCOUNT_ADAPTER = 'accounts.adapter.AccountAdapter'

Jason D Yeomans's avatar
Jason D Yeomans committed
147
AUTHENTICATION_BACKENDS = (
148
    'django.contrib.auth.backends.ModelBackend',
Daniel W Bond's avatar
Daniel W Bond committed
149
    'cas.backends.CASBackend',
Jason D Yeomans's avatar
Jason D Yeomans committed
150
)
151

Daniel W Bond's avatar
Daniel W Bond committed
152
CAS_SERVER_URL = 'https://login.gmu.edu'
153
154
CAS_LOGOUT_COMPLETELY = True
CAS_PROVIDE_URL_TO_LOGOUT = True
155

156
157
158
CAS_RESPONSE_CALLBACKS = (
    'accounts.cas_callbacks.create_user',
)
Daniel W Bond's avatar
Daniel W Bond committed
159
160
161
162
163
164
165
166
167
168
169
170
171

HAYSTACK_CONNECTIONS = {
    'default' : {
        'ENGINE' : 'haystack.backends.whoosh_backend.WhooshEngine',
        'PATH' : os.path.join(os.path.dirname(__file__), 'whoosh_index'),
    },
}

# Haystack Signal Processor
# The RealtimeSignalProcessor allows for objects to indexed as soon as
# they are created -- in real time.
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'

172
173
174
175
176
177
178
179
180
181
# Use redis cache when not in local development
if DEBUG:
    pass
else:
    CACHES = {
        'default': {
            'BACKEND': 'redis_cache.RedisCache',
            'LOCATION': '/var/run/redis/redis.sock',
        },
    }