forked from mozilla/addons-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
167 lines (130 loc) Β· 5.34 KB
/
settings.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
"""This is the standard development settings file.
If you need to overload settings, please do so in a local_settings.py file (it
won't be tracked in git).
"""
import os
from urllib.parse import urlparse
from olympia.lib.settings_base import * # noqa
WSGI_APPLICATION = 'olympia.wsgi.application'
INTERNAL_ROUTES_ALLOWED = True
DEBUG = True
# These apps are great during development.
INSTALLED_APPS += (
'olympia.landfill',
'debug_toolbar',
)
# Override logging config to enable DEBUG logs for (almost) everything.
LOGGING['root']['level'] = logging.DEBUG
for logger in list(LOGGING['loggers'].keys()):
if logger not in ['filtercascade', 'mohawk.util', 'post_request_task']:
# It is important to keep the loggers configured in `settings_base.py`
# so we only update the level below:
LOGGING['loggers'][logger]['level'] = logging.DEBUG
# django-debug-doolbar middleware needs to be inserted as high as possible
# but after GZip middleware
def insert_debug_toolbar_middleware(middlewares):
ret_middleware = list(middlewares)
for i, middleware in enumerate(ret_middleware):
if 'GZipMiddleware' in middleware:
ret_middleware.insert(
i + 1, 'debug_toolbar.middleware.DebugToolbarMiddleware')
break
return tuple(ret_middleware)
MIDDLEWARE = insert_debug_toolbar_middleware(MIDDLEWARE)
DEBUG_TOOLBAR_CONFIG = {
# Enable django-debug-toolbar locally, if DEBUG is True.
'SHOW_TOOLBAR_CALLBACK': lambda request: DEBUG,
}
FILESYSTEM_CACHE_ROOT = os.path.join(TMP_PATH, 'cache')
# We are setting memcached here to make sure our local setup is as close
# to our production system as possible.
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': os.environ.get('MEMCACHE_LOCATION', 'localhost:11211'),
},
}
# If you're not running on SSL you'll want this to be False.
SESSION_COOKIE_SECURE = False
SESSION_COOKIE_DOMAIN = None
WAFFLE_SECURE = False
CELERY_TASK_ALWAYS_EAGER = False
# Locally we typically don't run more than 1 elasticsearch node. So we set
# replicas to zero.
ES_DEFAULT_NUM_REPLICAS = 0
SITE_URL = os.environ.get('OLYMPIA_SITE_URL') or 'http://localhost:8000'
DOMAIN = SERVICES_DOMAIN = urlparse(SITE_URL).netloc
SERVICES_URL = SITE_URL
INTERNAL_SITE_URL = 'http://nginx'
EXTERNAL_SITE_URL = SITE_URL
CODE_MANAGER_URL = (
os.environ.get('CODE_MANAGER_URL') or 'http://olympia.test:5000')
ALLOWED_HOSTS = ALLOWED_HOSTS + [SERVICES_DOMAIN, 'nginx']
# Default AMO user id to use for tasks (from users.json fixture in zadmin).
TASK_USER_ID = 10968
ALLOW_SELF_REVIEWS = True
AES_KEYS = {
'api_key:secret': os.path.join(
ROOT, 'src', 'olympia', 'api', 'tests', 'assets', 'test-api-key.txt'),
}
DATABASES = {
'default': get_db_config('DATABASES_DEFAULT_URL'),
}
# FxA config for local development only.
FXA_CONFIG = {
'default': {
'client_id': env('FXA_CLIENT_ID', default='a25796da7bc73ffa'),
'client_secret': env(
'FXA_CLIENT_SECRET',
default='4828af02f60a12738a79c7121b06d42b481f112dce1831440902a8412d2770c5'), # noqa
# fxa redirects to http://olympia.test/api/auth/authenticate-callback/
},
'amo': {
'client_id': env('FXA_CLIENT_ID', default='0f95f6474c24c1dc'),
'client_secret': env(
'FXA_CLIENT_SECRET',
default='ca45e503a1b4ec9e2a3d4855d79849e098da18b7dfe42b6bc76dfed420fc1d38'), # noqa
# fxa redirects to http://localhost:3000/fxa-authenticate
},
'local': {
'client_id': env('FXA_CLIENT_ID', default='4dce1adfa7901c08'),
'client_secret': env(
'FXA_CLIENT_SECRET',
default='d7d5f1148a35b12c067fb9eafafc29d35165a90f5d8b0032f1fcd37468ae49fe'), # noqa
# noqa fxa redirects to http://localhost:3000/api/auth/authenticate-callback/?config=local #noqa
},
}
FXA_CONTENT_HOST = 'https://stable.dev.lcip.org'
FXA_OAUTH_HOST = 'https://oauth-stable.dev.lcip.org/v1'
FXA_PROFILE_HOST = 'https://stable.dev.lcip.org/profile/v1'
ALLOWED_FXA_CONFIGS = ['default', 'amo', 'local']
# When USE_FAKE_FXA_AUTH and settings.DEBUG are both True, we serve a fake
# authentication page, bypassing FxA. To disable this behavior, set
# USE_FAKE_FXA = False in your local settings.
USE_FAKE_FXA_AUTH = True
# CSP report endpoint which returns a 204 from addons-nginx in local dev.
CSP_REPORT_URI = '/csp-report'
RESTRICTED_DOWNLOAD_CSP['REPORT_URI'] = CSP_REPORT_URI
# Allow GA over http + www subdomain in local development.
HTTP_GA_SRC = 'http://www.google-analytics.com'
CSP_IMG_SRC += (HTTP_GA_SRC,)
CSP_SCRIPT_SRC += (HTTP_GA_SRC, "'self'")
# Auth token required to authorize inbound email.
INBOUND_EMAIL_SECRET_KEY = 'totally-unsecure-secret-string'
# Validation key we need to send in POST response.
INBOUND_EMAIL_VALIDATION_KEY = 'totally-unsecure-validation-string'
# Sectools
CUSTOMS_API_URL = 'http://customs:10101/'
CUSTOMS_API_KEY = 'customssecret'
WAT_API_URL = 'http://wat:10102/'
WAT_API_KEY = 'watsecret'
REMOTE_SETTINGS_IS_TEST_SERVER = True
# If you have settings you want to overload, put them in a local_settings.py.
try:
from local_settings import * # noqa
except ImportError:
import warnings
import traceback
warnings.warn('Could not import local_settings module. {}'.format(
traceback.format_exc()))
SITEMAP_DEBUG_AVAILABLE = True