settings.py 3.5 KB
Newer Older
Daniel Warren Bond's avatar
Daniel Warren Bond committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Django settings for advisor project.

For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""

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

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '9!1f(9=vz_e_*_l88(!_7_xag@1+yadf3ac*a-h297ij@@dhw7'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []

Daniel W Bond's avatar
Daniel W Bond committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

STATIC_ROOT = ''

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    'static',
)

STATICFILE_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

TEMPLATE_DIRS = (
    'templates',
)

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)
Daniel Warren Bond's avatar
Daniel Warren Bond committed
52
53
54
55
56
57
58
59
60
61

# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
Daniel W Bond's avatar
Daniel W Bond committed
62
63
    'trajectories',
    'south',
Daniel Warren Bond's avatar
Daniel Warren Bond committed
64
65
66
67
68
69
70
71
72
73
74
)

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

Daniel W Bond's avatar
Daniel W Bond committed
75
ROOT_URLCONF = 'advisor.urls'
Daniel Warren Bond's avatar
Daniel Warren Bond committed
76

Daniel W Bond's avatar
Daniel W Bond committed
77
WSGI_APPLICATION = 'advisor.wsgi.application'
Daniel Warren Bond's avatar
Daniel Warren Bond committed
78
79
80
81
82
83
84
85
86
87
88
89


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

Daniel W Bond's avatar
Daniel W Bond committed
90
91
92
93
94
# ordering of apps in admin interface
# https://djangosnippets.org/snippets/1939/
# ADMIN_REORDER = (
# )

Daniel Warren Bond's avatar
Daniel Warren Bond committed
95
96
97
98
99
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

LANGUAGE_CODE = 'en-us'

Daniel W Bond's avatar
Daniel W Bond committed
100
TIME_ZONE = 'America/New_York'
Daniel Warren Bond's avatar
Daniel Warren Bond committed
101
102
103
104
105
106
107

USE_I18N = True

USE_L10N = True

USE_TZ = True

Daniel W Bond's avatar
Daniel W Bond committed
108
##### LDAP #####
Daniel Warren Bond's avatar
Daniel Warren Bond committed
109

Daniel W Bond's avatar
Daniel W Bond committed
110
111
import ldap
# Baseline configuration
Daniel Warren Bond's avatar
Daniel Warren Bond committed
112

Daniel W Bond's avatar
Daniel W Bond committed
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Keep ModelBackend around for per-user permissions and maybe a local
# superuser.
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)

# GMU LDAP database. This is also accessible at newldap.gmu.edu
AUTH_LDAP_SERVER_URI = "ldaps://directory.gmu.edu:636"
AUTH_LDAP_BIND_DN = "ou=people,o=gmu.edu"

# Since we authenticate by logging into the LDAP server, you need to
# bind to the LDAP server as the authenticating user.
AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = True

# This sticks the "user" plug into the hole in the DN string.
AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=people,o=gmu.edu"

# Basically this is required to ignore the self-signed GMU cert.
AUTH_LDAP_GLOBAL_OPTIONS = {
ldap.OPT_X_TLS : ldap.OPT_X_TLS_DEMAND,
ldap.OPT_X_TLS_REQUIRE_CERT : ldap.OPT_X_TLS_NEVER,
}

# Populate the Django User model from the LDAP directory.
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
"email": "mail"
}

AUTH_LDAP_ALWAYS_UPDATE_USER = True