2023-07-10 17:31:09 +03:00
|
|
|
# ruff: noqa: F405
|
2014-08-08 16:08:46 +04:00
|
|
|
"""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).
|
|
|
|
|
|
|
|
"""
|
2024-03-18 14:28:28 +03:00
|
|
|
|
2014-10-01 15:44:44 +04:00
|
|
|
import os
|
2019-07-16 13:01:31 +03:00
|
|
|
from urllib.parse import urlparse
|
2014-10-01 15:44:44 +04:00
|
|
|
|
2015-12-16 11:46:10 +03:00
|
|
|
from olympia.lib.settings_base import * # noqa
|
2014-08-08 16:08:46 +04:00
|
|
|
|
2023-05-23 17:36:16 +03:00
|
|
|
|
2016-03-15 17:22:16 +03:00
|
|
|
WSGI_APPLICATION = 'olympia.wsgi.application'
|
|
|
|
|
2020-05-25 12:51:18 +03:00
|
|
|
INTERNAL_ROUTES_ALLOWED = True
|
|
|
|
|
2014-08-08 16:08:46 +04:00
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
# These apps are great during development.
|
|
|
|
INSTALLED_APPS += (
|
2015-12-16 11:46:10 +03:00
|
|
|
'olympia.landfill',
|
2019-04-16 16:42:42 +03:00
|
|
|
'debug_toolbar',
|
2014-08-08 16:08:46 +04:00
|
|
|
)
|
|
|
|
|
2020-05-19 17:54:15 +03:00
|
|
|
# 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']:
|
2020-06-05 14:30:11 +03:00
|
|
|
# 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
|
2020-03-03 21:27:34 +03:00
|
|
|
|
2020-07-27 12:47:51 +03:00
|
|
|
|
2019-10-07 16:33:49 +03:00
|
|
|
# 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(
|
2022-01-27 16:17:34 +03:00
|
|
|
i + 1, 'debug_toolbar.middleware.DebugToolbarMiddleware'
|
|
|
|
)
|
2019-10-07 16:33:49 +03:00
|
|
|
break
|
|
|
|
|
|
|
|
return tuple(ret_middleware)
|
|
|
|
|
2020-03-03 21:27:34 +03:00
|
|
|
|
2019-10-07 16:33:49 +03:00
|
|
|
MIDDLEWARE = insert_debug_toolbar_middleware(MIDDLEWARE)
|
2019-04-16 16:42:42 +03:00
|
|
|
|
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
|
|
# Enable django-debug-toolbar locally, if DEBUG is True.
|
|
|
|
'SHOW_TOOLBAR_CALLBACK': lambda request: DEBUG,
|
|
|
|
}
|
|
|
|
|
2018-03-05 16:34:43 +03:00
|
|
|
FILESYSTEM_CACHE_ROOT = os.path.join(TMP_PATH, 'cache')
|
|
|
|
|
2014-08-08 16:08:46 +04:00
|
|
|
# If you're not running on SSL you'll want this to be False.
|
|
|
|
SESSION_COOKIE_SECURE = False
|
|
|
|
SESSION_COOKIE_DOMAIN = None
|
2020-06-05 18:45:39 +03:00
|
|
|
WAFFLE_SECURE = False
|
2014-08-08 16:08:46 +04:00
|
|
|
|
2017-10-16 12:16:41 +03:00
|
|
|
CELERY_TASK_ALWAYS_EAGER = False
|
2014-08-08 16:08:46 +04:00
|
|
|
|
|
|
|
# Locally we typically don't run more than 1 elasticsearch node. So we set
|
|
|
|
# replicas to zero.
|
|
|
|
ES_DEFAULT_NUM_REPLICAS = 0
|
|
|
|
|
2015-10-30 20:21:04 +03:00
|
|
|
SITE_URL = os.environ.get('OLYMPIA_SITE_URL') or 'http://localhost:8000'
|
2018-10-17 18:52:21 +03:00
|
|
|
DOMAIN = SERVICES_DOMAIN = urlparse(SITE_URL).netloc
|
2022-02-01 22:34:44 +03:00
|
|
|
ADDONS_FRONTEND_PROXY_PORT = '7000'
|
2016-07-20 12:05:29 +03:00
|
|
|
SERVICES_URL = SITE_URL
|
2020-08-05 18:35:25 +03:00
|
|
|
INTERNAL_SITE_URL = 'http://nginx'
|
2019-06-06 13:04:06 +03:00
|
|
|
EXTERNAL_SITE_URL = SITE_URL
|
2021-10-15 12:53:13 +03:00
|
|
|
STATIC_URL = '%s/static/' % EXTERNAL_SITE_URL
|
|
|
|
MEDIA_URL = '%s/user-media/' % EXTERNAL_SITE_URL
|
2014-08-08 16:08:46 +04:00
|
|
|
|
2022-01-27 16:17:34 +03:00
|
|
|
CODE_MANAGER_URL = os.environ.get('CODE_MANAGER_URL') or 'http://olympia.test:5000'
|
2019-03-29 07:35:03 +03:00
|
|
|
|
2024-08-27 13:42:10 +03:00
|
|
|
ALLOWED_HOSTS = ALLOWED_HOSTS + [SERVICES_DOMAIN, 'nginx', '127.0.0.1']
|
2016-11-02 18:56:10 +03:00
|
|
|
|
2015-03-07 18:22:21 +03:00
|
|
|
# Default AMO user id to use for tasks (from users.json fixture in zadmin).
|
|
|
|
TASK_USER_ID = 10968
|
|
|
|
|
2018-04-09 17:48:02 +03:00
|
|
|
ALLOW_SELF_REVIEWS = True
|
2015-09-22 14:29:46 +03:00
|
|
|
|
2015-10-08 22:45:44 +03:00
|
|
|
AES_KEYS = {
|
2015-12-28 22:08:27 +03:00
|
|
|
'api_key:secret': os.path.join(
|
2022-01-27 16:17:34 +03:00
|
|
|
ROOT, 'src', 'olympia', 'api', 'tests', 'assets', 'test-api-key.txt'
|
|
|
|
),
|
2015-10-08 22:45:44 +03:00
|
|
|
}
|
|
|
|
|
2019-01-18 18:11:31 +03:00
|
|
|
DATABASES = {
|
2019-03-18 13:57:49 +03:00
|
|
|
'default': get_db_config('DATABASES_DEFAULT_URL'),
|
2019-01-18 18:11:31 +03:00
|
|
|
}
|
|
|
|
|
2022-09-20 12:24:40 +03:00
|
|
|
FXA_CONTENT_HOST = 'https://accounts.stage.mozaws.net'
|
|
|
|
FXA_OAUTH_HOST = 'https://oauth.stage.mozaws.net/v1'
|
|
|
|
FXA_PROFILE_HOST = 'https://profile.stage.mozaws.net/v1'
|
2015-10-08 22:45:44 +03:00
|
|
|
|
2020-10-12 20:19:50 +03:00
|
|
|
# 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.
|
2022-09-20 12:24:40 +03:00
|
|
|
# You will also need to specify `client_id` and `client_secret` in your
|
|
|
|
# local_settings.py or environment variables - you must contact the FxA team to get your
|
|
|
|
# own credentials for FxA stage.
|
2020-10-12 20:19:50 +03:00
|
|
|
USE_FAKE_FXA_AUTH = True
|
|
|
|
|
2016-01-11 20:30:32 +03:00
|
|
|
# CSP report endpoint which returns a 204 from addons-nginx in local dev.
|
|
|
|
CSP_REPORT_URI = '/csp-report'
|
2019-07-18 18:52:11 +03:00
|
|
|
RESTRICTED_DOWNLOAD_CSP['REPORT_URI'] = CSP_REPORT_URI
|
2016-01-11 20:30:32 +03:00
|
|
|
|
2021-10-15 12:53:13 +03:00
|
|
|
# Set CSP like we do for dev/stage/prod, but also allow GA over http + www subdomain
|
|
|
|
# for local development.
|
2016-01-12 00:00:25 +03:00
|
|
|
HTTP_GA_SRC = 'http://www.google-analytics.com'
|
2021-10-15 12:53:13 +03:00
|
|
|
|
|
|
|
CSP_CONNECT_SRC += (SITE_URL,)
|
|
|
|
CSP_FONT_SRC += (STATIC_URL,)
|
|
|
|
CSP_IMG_SRC += (MEDIA_URL, STATIC_URL, HTTP_GA_SRC)
|
|
|
|
CSP_SCRIPT_SRC += (STATIC_URL, HTTP_GA_SRC)
|
|
|
|
CSP_STYLE_SRC += (STATIC_URL,)
|
2016-01-12 00:00:25 +03:00
|
|
|
|
2016-08-10 23:04:57 +03:00
|
|
|
# Auth token required to authorize inbound email.
|
2016-10-04 13:53:58 +03:00
|
|
|
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'
|
2016-08-10 23:04:57 +03:00
|
|
|
|
2019-08-29 13:21:20 +03:00
|
|
|
# Sectools
|
|
|
|
CUSTOMS_API_URL = 'http://customs:10101/'
|
|
|
|
CUSTOMS_API_KEY = 'customssecret'
|
|
|
|
|
2020-07-27 12:47:51 +03:00
|
|
|
REMOTE_SETTINGS_IS_TEST_SERVER = True
|
2020-03-03 21:27:34 +03:00
|
|
|
|
2024-02-26 11:13:35 +03:00
|
|
|
local_settings_path = path('local_settings.py')
|
|
|
|
|
|
|
|
if not os.path.exists(local_settings_path):
|
|
|
|
with open(local_settings_path, 'w') as file:
|
|
|
|
file.write('# Put settings you want to overload in this file.\n')
|
|
|
|
|
|
|
|
from local_settings import * # noqa
|
2021-04-13 13:04:48 +03:00
|
|
|
|
|
|
|
SITEMAP_DEBUG_AVAILABLE = True
|
2022-06-07 13:54:23 +03:00
|
|
|
|
|
|
|
# Recaptcha test keys from https://developers.google.com/recaptcha/docs/faq.
|
|
|
|
# Will show the widget but no captcha, verification will always pass.
|
|
|
|
RECAPTCHA_PUBLIC_KEY = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
|
|
|
|
RECAPTCHA_PRIVATE_KEY = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'
|
2023-12-11 20:26:58 +03:00
|
|
|
|
2023-12-14 15:46:45 +03:00
|
|
|
ADDONS_SERVER_DOCS_URL = 'https://addons-server.readthedocs.io/en/latest'
|
|
|
|
|
|
|
|
|
2023-12-11 20:26:58 +03:00
|
|
|
SWAGGER_SETTINGS = {
|
|
|
|
'USE_SESSION_AUTH': False,
|
|
|
|
'DEEP_LINKING': True,
|
2023-12-14 15:46:45 +03:00
|
|
|
'SECURITY_DEFINITIONS': {
|
|
|
|
'Session ID': {
|
|
|
|
'type': 'apiKey',
|
|
|
|
'name': 'Authorization',
|
|
|
|
'in': 'header',
|
|
|
|
'description': (
|
|
|
|
'Use your session ID found in the sessionid cookie. See the '
|
|
|
|
f'[docs]({ADDONS_SERVER_DOCS_URL}/topics/api/auth_internal.html). \n'
|
|
|
|
'Format as `Session <sessionid>`'
|
|
|
|
),
|
|
|
|
},
|
|
|
|
'JWT': {
|
|
|
|
'type': 'apiKey',
|
|
|
|
'name': 'Authorization',
|
|
|
|
'in': 'header',
|
|
|
|
'description': (
|
|
|
|
'Use JWT token. see the '
|
|
|
|
f'[docs]({ADDONS_SERVER_DOCS_URL}/topics/api/auth.html). \n'
|
|
|
|
'Format as `JWT <token>`'
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'PERSIST_AUTH': True,
|
2023-12-11 20:26:58 +03:00
|
|
|
}
|