This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
/
default.py
138 lines (108 loc) · 3.35 KB
/
default.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
# -*- coding: utf-8 -*-
# Django settings for the mozillians project.
import ldap
import logging
from django_auth_ldap.config import _LDAPConfig, LDAPSearch
from funfactory.manage import path
from funfactory import settings_base as base
from settings import initial as pre
## Log settings
SYSLOG_TAG = "http_app_mozillians"
LOGGING = {
'loggers': {
'landing': {'level': logging.INFO},
'phonebook': {'level': logging.INFO},
},
}
## L10n
LOCALE_PATHS = [path('locale')]
# Accepted locales
PROD_LANGUAGES = ('de', 'en-US', 'es', 'fr', 'pl', 'sl', 'sq', 'zh-TW')
# List of RTL locales known to this project. Subset of LANGUAGES.
RTL_LANGUAGES = () # ('ar', 'fa', 'fa-IR', 'he')
# For absoluate urls
PROTOCOL = "https://"
PORT = 443
## Media and templates.
TEMPLATE_DIRS = (path('apps/users/templates'), )
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'jingo.Loader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MINIFY_BUNDLES = {
'css': {
'common': (
'css/mozilla-base.css',
'css/main.css',
),
},
'js': {
'common': (
'js/libs/jquery-1.4.4.min.js',
'js/main.js',
),
}
}
MIDDLEWARE_CLASSES = list(base.MIDDLEWARE_CLASSES) + [
'commonware.response.middleware.StrictTransportMiddleware',
'phonebook.middleware.PermissionDeniedMiddleware',
'larper.middleware.LarperMiddleware',
]
# StrictTransport
STS_SUBDOMAINS = True
# OpenLDAP
LDAP_USERS_GROUP = 'ou=people,dc=mozillians,dc=org'
# django-auth-ldap
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
)
AUTH_LDAP_USER_SEARCH = LDAPSearch(LDAP_USERS_GROUP, ldap.SCOPE_SUBTREE,
"(uid=%(user)s)")
AUTH_LDAP_USER_ATTR_MAP = {"first_name": "cn", "last_name": "sn",
"email": "mail"}
AUTH_LDAP_PROFILE_ATTR_MAP = {"home_directory": "homeDirectory",
"unique_id": "uniqueIdentifier",
"phone": "telephoneNumber:",
"voucher": "mozilliansVouchedBy"}
AUTH_LDAP_ALWAYS_UPDATE_USER = False
INSTALLED_APPS = list(base.INSTALLED_APPS) + [
'landing',
'phonebook',
'users',
'larper',
# Local apps
'jingo_minify',
'tower', # for ./manage.py extract (L10n)
'django.contrib.admin',
'django.contrib.auth',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
]
## Auth
PWD_ALGORITHM = 'bcrypt'
HMAC_KEYS = {
'2011-01-01': 'cheesecake',
}
SESSION_COOKIE_HTTPONLY = True
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
# Email
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Auth
LOGIN_URL = '/login'
LOGIN_REDIRECT_URL = '/'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
#: Userpics will be uploaded here.
USERPICS_PATH = pre.NETAPP_STORAGE + '/userpics'
#: Userpics will accessed here.
USERPICS_URL = pre.UPLOAD_URL + '/userpics'
AUTH_PROFILE_MODULE = 'users.UserProfile'
MAX_PHOTO_UPLOAD_SIZE = 8 * (1024 ** 2)
AUTO_VOUCH_DOMAINS = ('mozilla.com', 'mozilla.org', 'mozillafoundation.org')