This repository has been archived by the owner on Oct 28, 2020. It is now read-only.
/
base.py
182 lines (136 loc) · 4.59 KB
/
base.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# This is your project's main settings file that can be committed to your
# repo. If you need to override a setting locally, use settings_local.py
from funfactory.settings_base import * # noqa
# Defines the views served for root URLs.
ROOT_URLCONF = 'remo.urls'
INSTALLED_APPS = get_apps(append=[
# Application base, containing global templates.
'django.contrib.admin',
'django.contrib.messages',
'django.contrib.markup',
'remo.base',
'remo.profiles',
'remo.featuredrep',
'remo.dashboard',
'remo.remozilla',
'remo.reports',
'remo.api',
'remo.events',
'remo.voting',
'django_browserid',
'jingo_offline_compressor',
'tastypie',
'waffle',
'import_export',
'south',
'django_nose',
'django_filters',
'rest_framework'
])
# Because Jinja2 is the default template loader, add any non-Jinja templated
# apps here:
JINGO_EXCLUDE_APPS = [
'admin',
'registration',
'browserid',
'rest_framework'
]
# Tells the extract script what files to look for L10n in and what function
# handles the extraction. The Tower library expects this.
# # Use this if you have localizable HTML files:
# DOMAIN_METHODS['lhtml'] = [
# ('**/templates/**.lhtml',
# 'tower.management.commands.extract.extract_tower_template'),
# ]
# # Use this if you have localizable HTML files:
# DOMAIN_METHODS['javascript'] = [
# # Make sure that this won't pull in strings from external libraries you
# # may use.
# ('media/js/**.js', 'javascript'),
# ]
LOGGING = dict(loggers=dict(playdoh={'level': logging.DEBUG}))
# Add BrowserID as authentication backend
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',
'remo.base.backend.RemoBrowserIDBackend')
# Required for BrowserID. Very important security feature
SITE_URL = 'https://reps.mozilla.org'
# Override BrowserID verification
BROWSERID_VERIFY_CLASS = 'remo.base.views.BrowserIDVerify'
# Browserid Audiences
BROWSERID_AUDIENCES = [SITE_URL]
# Optional BrowserID settings
LOGIN_REDIRECT_URL = '/dashboard/'
LOGIN_REDIRECT_URL_FAILURE = '/'
LOGOUT_REDIRECT_URL = '/'
# Remove LocaleURLMiddleware since we are not localing our website
MIDDLEWARE_CLASSES = filter(
lambda x: x != 'funfactory.middleware.LocaleURLMiddleware',
MIDDLEWARE_CLASSES)
MIDDLEWARE_CLASSES += (
'django.contrib.messages.middleware.MessageMiddleware',
'remo.base.middleware.RegisterMiddleware',
'waffle.middleware.WaffleMiddleware'
)
TEMPLATE_CONTEXT_PROCESSORS += (
'django.core.context_processors.static',
'django.contrib.messages.context_processors.messages'
)
# Instruct session-csrf to always produce tokens for anonymous users
ANON_ALWAYS = True
FROM_EMAIL = 'The ReMoBot <reps@mozilla.com>'
ADMINS = (
('Mozilla Reps Devs', 'reps-dev@mozilla.com'),
)
MANAGERS = ADMINS
# Allow robots to crawl the site.
ENGAGE_ROBOTS = True
TIME_ZONE = 'UTC'
USE_TZ = True
ETHERPAD_URL = 'http://etherpad.mozilla.org/'
ETHERPAD_PREFIX = 'remo-'
CONTRIBUTE_URL = ('http://www.mozilla.org/contribute/'
'event/?callbackurl=%(callbackurl)s')
REPS_MENTORS_LIST = 'reps-mentors@lists.mozilla.org'
REPS_COUNCIL_ALIAS = 'reps-council@mozilla.com'
# Mozillians API
MOZILLIANS_API_BASE = 'https://mozillians.org'
ALLOWED_HOSTS = ['reps.mozilla.org']
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
jinja_conf = JINJA_CONFIG()
def JINJA_CONFIG():
jinja_conf['extensions'].append('caching.ext.cache')
return jinja_conf
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = 'UTC'
COMPRESS_ENABLED = True
COMPRESS_OFFLINE = True
def _request_args():
from django.conf import settings
from tower import ugettext_lazy as _lazy
args = {'siteName': _lazy('Mozilla Reps'), }
if settings.SITE_URL.startswith('https'):
args['siteLogo'] = '/static/base/img/remo/remo_logo_medium.png'
return args
BROWSERID_REQUEST_ARGS = lazy(_request_args, dict)()
# Statsd Graphite
STATSD_CLIENT = 'django_statsd.clients.normal'
# Paginator settings
ITEMS_PER_PAGE = 25
# django-celery setup
import djcelery # noqa
djcelery.setup_loader()
MAPBOX_TOKEN = 'examples.map-i86nkdio'
SERVER_EMAIL = 'reps-dev@mozilla.com'
# Django Rest Framework
REST_FRAMEWORK = {
'URL_FIELD_NAME': '_url',
'PAGINATE_BY': 20,
'MAX_PAGINATE_BY': 100,
'DEFAULT_MODEL_SERIALIZER_CLASS':
'rest_framework.serializers.HyperlinkedModelSerializer',
'DEFAULT_FILTER_BACKENDS': (
'rest_framework.filters.DjangoFilterBackend',
'rest_framework.filters.OrderingFilter',
),
}