settings.py 4.67 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
from __future__ import absolute_import, print_function

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

17
18
ORGANIZATION_EMAIL_DOMAIN = 'masonlive.gmu.edu'

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

25
26
27
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)
28

29
print(TEMPLATE_DIRS)
30
31
32
33
34
35
36
37

TEMPLATE_LOADERS = (

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

)

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

52
53
54
55
import config
DEBUG = config.DEBUG
TEMPLATE_DEBUG = config.TEMPLATE_DEBUG
ALLOWED_HOSTS = config.ALLOWED_HOSTS
56

Daniel W Bond's avatar
Daniel W Bond committed
57
58
59
PIWIK_DOMAIN_PATH = config.PIWIK_DOMAIN_PATH
PIWIK_SITE_ID = config.PIWIK_SITE_ID

60
61
62
63
64
65
66
67
68
# 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
69
    'django.contrib.sites',
70
    'django.contrib.humanize',
Daniel W Bond's avatar
Daniel W Bond committed
71
    # apps
72
    'api',
73
    'housing',
74
    'accounts',
Daniel W Bond's avatar
Daniel W Bond committed
75
    # packages
76
77
    'crispy_forms',
    'django_gravatar',
Daniel W Bond's avatar
Daniel W Bond committed
78
    'analytical',
79
    'randomslugfield',
Daniel W Bond's avatar
Daniel W Bond committed
80
    'haystack',
81
    'multiselectfield',
Jason D Yeomans's avatar
Jason D Yeomans committed
82
83
84
85
86
87
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.facebook',
    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.twitter',
88
    'allauth.socialaccount.providers.instagram',
89
90
)

91
92
CRISPY_TEMPLATE_PACK = 'bootstrap'

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

    'django.middleware.csrf.CsrfViewMiddleware',
101
102
103
104
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

105
ROOT_URLCONF = 'settings.urls'
106

107
WSGI_APPLICATION = 'settings.wsgi.application'
108

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

113
114
SECRET_KEY = secret.SECRET_KEY

115
116
DATABASES = {
    'default': {
117
        'ENGINE': config.DB_ENGINE,
118
119
120
121
122
        'NAME': secret.DB_NAME,
        'USER': secret.DB_USER,
        'PASSWORD': secret.DB_PASSWORD,
        'HOST': secret.DB_HOST,
        'PORT': secret.DB_PORT,
123
124
125
126
    }
}

# Internationalization
127
# https://docs.djangoproject.com/en/1.7/topics/i18n/
128
129
130

LANGUAGE_CODE = 'en-us'

131
TIME_ZONE = 'America/New_York'
132
133
134
135
136
137
138

USE_I18N = True

USE_L10N = True

USE_TZ = True

139
# set for social auth
140
141
# example.com is by default set to 1
SITE_ID = 2
Daniel W Bond's avatar
Daniel W Bond committed
142

143
# Static files (CSS, JavaScript, Images)
144
# https://docs.djangoproject.com/en/1.7/howto/static-files/
145
146

STATIC_URL = '/static/'
147

148
149
ACCOUNT_ADAPTER = 'accounts.adapter.AccountAdapter'

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

155
156
157
# Peoplefinder API for user creation
PF_URL = "http://api.srct.gmu.edu/pf/v1/"

Daniel W Bond's avatar
Daniel W Bond committed
158
CAS_SERVER_URL = 'https://login.gmu.edu'
159
160
CAS_LOGOUT_COMPLETELY = True
CAS_PROVIDE_URL_TO_LOGOUT = True
161

162
163
164
CAS_RESPONSE_CALLBACKS = (
    'accounts.cas_callbacks.create_user',
)
Daniel W Bond's avatar
Daniel W Bond committed
165
166
167
168
169
170
171
172
173
174
175
176
177

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'

178
179
180
181
182
183
184
185
186
187
# Use redis cache when not in local development
if DEBUG:
    pass
else:
    CACHES = {
        'default': {
            'BACKEND': 'redis_cache.RedisCache',
            'LOCATION': '/var/run/redis/redis.sock',
        },
    }