This repository has been archived by the owner on Feb 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
base.py
282 lines (228 loc) · 7.51 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# 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 *
# Name of the top-level module where you put all your apps.
# If you did not install Playdoh with the funfactory installer script
# you may need to edit this value. See the docs about installing from a
# clone.
PROJECT_MODULE = 'crashstats'
# Defines the views served for root URLs.
ROOT_URLCONF = '%s.urls' % PROJECT_MODULE
INSTALLED_APPS = list(INSTALLED_APPS) + [
# Application base, containing global templates.
'%s.base' % PROJECT_MODULE,
# Example code. Can (and should) be removed for actual projects.
'%s.crashstats' % PROJECT_MODULE,
'%s.api' % PROJECT_MODULE,
'%s.manage' % PROJECT_MODULE,
'%s.supersearch' % PROJECT_MODULE,
'jingo_offline_compressor',
'%s.auth' % PROJECT_MODULE,
'django_statsd',
'django.contrib.messages',
'raven.contrib.django.raven_compat',
'waffle',
]
# Because Jinja2 is the default template loader, add any non-Jinja templated
# apps here:
JINGO_EXCLUDE_APPS = [
'admin',
'registration',
]
MIDDLEWARE_EXCLUDE_CLASSES = [
'funfactory.middleware.LocaleURLMiddleware',
]
MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
for app in MIDDLEWARE_EXCLUDE_CLASSES:
if app in MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES.remove(app)
MIDDLEWARE_CLASSES = tuple(MIDDLEWARE_CLASSES) + (
'django_statsd.middleware.GraphiteRequestTimingMiddleware',
'django_statsd.middleware.GraphiteMiddleware',
'waffle.middleware.WaffleMiddleware',
)
STATSD_CLIENT = 'django_statsd.clients.normal'
# BrowserID configuration
AUTHENTICATION_BACKENDS = [
'django_browserid.auth.BrowserIDBackend',
'django.contrib.auth.backends.ModelBackend',
]
TEMPLATE_CONTEXT_PROCESSORS += (
'django_browserid.context_processors.browserid_form',
'django.core.context_processors.request',
)
# Always generate a CSRF token for anonymous users.
ANON_ALWAYS = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'sqlite.crashstats.db',
}
}
# Tells the extract script what files to look for L10n in and what function
# handles the extraction. The Tower library expects this.
DOMAIN_METHODS['messages'] = [
('%s/**.py' % PROJECT_MODULE,
'tower.management.commands.extract.extract_tower_python'),
('%s/**/templates/**.html' % PROJECT_MODULE,
'tower.management.commands.extract.extract_tower_template'),
('templates/**.html',
'tower.management.commands.extract.extract_tower_template'),
],
# # 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 JS 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}))
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
# fox2mike suggest to use IP instead of localhost
'LOCATION': '127.0.0.1:11211',
'TIMEOUT': 500,
'KEY_PREFIX': 'crashstats',
}
}
# Middleware related stuff
CACHE_MIDDLEWARE = True
CACHE_MIDDLEWARE_FILES = False # store on filesystem instead of cache server
# Some products have a different name in bugzilla and Socorro.
BUG_PRODUCT_MAP = {
'FennecAndroid': 'Firefox for Android',
'B2G': 'Boot2Gecko',
}
# Link to source if possible
VCS_MAPPINGS = {
'cvs': {
'cvs.mozilla.org': ('http://bonsai.mozilla.org/cvsblame.cgi?'
'file=%(file)s&rev=%(revision)s&'
'mark=%(line)s#%(line)s')
},
'hg': {
'hg.mozilla.org': ('http://hg.mozilla.org/%(repo)s'
'/annotate/%(revision)s/%(file)s#l%(line)s')
},
'git': {
'git.mozilla.org': ('http://git.mozilla.org/?p=%(repo)s;a=blob;'
'f=%(file)s;h=%(revision)s#l%(line)s'),
'github.com': ('https://github.com/%(repo)s/blob/%(revision)s/'
'%(file)s#L%(line)s')
}
}
# top three operating systems
OPERATING_SYSTEMS = (
'Linux',
'Mac OS X',
'Windows',
)
# Identifies nightly releases
NIGHTLY_RELEASE_TYPES = (
'Aurora',
'Nightly',
)
# by default, compression is done in runtime.
COMPRESS_OFFLINE = False
# True if old legacy URLs we handle should be permanent 301 redirects.
# Transitionally it might be safer to set this to False as we roll out the new
# django re-write of Socorro.
PERMANENT_LEGACY_REDIRECTS = True
# This is needed for BrowserID to work!
SITE_URL = 'http://localhost:8000'
LOGIN_URL = '/login/'
ALLOWED_PERSONA_EMAILS = (
# fill this in in settings/local.py
)
# Use memcached for session storage
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
# we don't need bcrypt since we don't store real passwords
PWD_ALGORITHM = 'sha512'
# must be set but not applicable because we don't use bcrypt
HMAC_KEYS = {'any': 'thing'}
# Types of query that can be run in search
QUERY_TYPES = (
'contains',
'is_exactly',
'starts_with',
'simple',
'exact', # for backward compatibility
'startswith', # for backward compatibility
)
# This is for backward compatibility with the PHP app.
QUERY_TYPES_MAP = {
'exact': 'is_exactly',
'startswith': 'starts_with',
}
# Maximum and default range of query that can be run in search
QUERY_RANGE_MAXIMUM_DAYS = 30
QUERY_RANGE_DEFAULT_DAYS = 14
# range unit values to allow in queries
RANGE_UNITS = (
'weeks',
'days',
'hours',
)
# process types to allow in queries
PROCESS_TYPES = (
'any',
'browser',
'plugin',
'content',
'all', # alias for 'any'
)
# hang types to allow in queries
HANG_TYPES = (
'any',
'crash',
'hang-p',
'all', # alias for 'any'
)
# plugin fields to allow in queries
PLUGIN_FIELDS = (
'filename',
'name',
)
# this is the max length of signatures in forms
SIGNATURE_MAX_LENGTH = 255
# We use django.contrib.messages for login, so let's use SessionStorage
# to avoid byte-big messages as cookies
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
# LDAP related settings
# feel free to override these in settings/local.py
LDAP_SERVER_URI = 'ldap://pm-ns.mozilla.org'
# search base where querys start
LDAP_SEARCH_BASE_USER = 'dc=mozilla'
LDAP_SEARCH_BASE_GROUP = 'ou=groups,dc=mozilla'
# groups you must belong to to be able log in
LDAP_GROUP_NAMES = ['CrashReportsAdmin']
# list of group queries that is intersected wih the `LDAP_GROUP_NAMES` search
LDAP_GROUP_QUERIES = [
'mail=%(mail)s,o=com,dc=mozilla',
'mail=%(mail)s,o=org,dc=mozilla',
'mail=%(mail)s,o=net,dc=mozillacom',
]
# A prefix that is sometimes prefixed on the crash ID when used elsewhere in
# the socorro eco-system.
CRASH_ID_PREFIX = 'bp-'
# If true, allow robots to spider the site
ENGAGE_ROBOTS = False
# Base URL for when we use the Bugzilla API
BZAPI_BASE_URL = 'https://api-dev.bugzilla.mozilla.org/1.3'
# Specify the middleware implementation to use in the middleware
# Leave empty to use the default
SEARCH_MIDDLEWARE_IMPL = None
# Valid type for correlations reports
CORRELATION_REPORT_TYPES = (
'core-counts',
'interesting-addons',
'interesting-addons-with-versions',
'interesting-modules',
'interesting-modules-with-versions'
)
from version import *