• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / fx-private-relay / 3a6450ae-a00f-4273-b3eb-2e655a290881

31 May 2024 12:06AM CUT coverage: 84.58%. Remained the same
3a6450ae-a00f-4273-b3eb-2e655a290881

push

circleci

actions-user
Merge in latest l10n strings

3661 of 4794 branches covered (76.37%)

Branch coverage included in aggregate %.

15015 of 17287 relevant lines covered (86.86%)

10.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.65
/privaterelay/settings.py
1
"""
2
Django settings for privaterelay project.
3

4
Generated by 'django-admin startproject' using Django 2.2.2.
5

6
For more information on this file, see
7
https://docs.djangoproject.com/en/2.2/topics/settings/
8

9
For the full list of settings and their values, see
10
https://docs.djangoproject.com/en/2.2/ref/settings/
11
"""
12

13
from __future__ import annotations
1✔
14

15
import base64
1✔
16
import ipaddress
1✔
17
import os
1✔
18
import sys
1✔
19
from hashlib import sha256
1✔
20
from pathlib import Path
1✔
21
from typing import TYPE_CHECKING, Any, cast, get_args
1✔
22

23
from django.conf.global_settings import LANGUAGES as DEFAULT_LANGUAGES
1✔
24

25
import dj_database_url
1✔
26
import django_stubs_ext
1✔
27
import markus
1✔
28
import sentry_sdk
1✔
29
from decouple import Choices, Csv, config
1✔
30
from sentry_sdk.integrations.django import DjangoIntegration
1✔
31
from sentry_sdk.integrations.logging import ignore_logger
1✔
32

33
from .types import RELAY_CHANNEL_NAME
1✔
34

35
if TYPE_CHECKING:
36
    import wsgiref.headers
37

38
try:
1✔
39
    # Silk is a live profiling and inspection tool for the Django framework
40
    # https://github.com/jazzband/django-silk
41
    import silk  # noqa: F401
1✔
42

43
    HAS_SILK = True
×
44
except ImportError:
1✔
45
    HAS_SILK = False
1✔
46

47
try:
1✔
48
    import google.cloud.sqlcommenter  # noqa: F401
1✔
49

50
    HAS_SQLCOMMENTER = True
1✔
51
except ImportError:
×
52
    HAS_SQLCOMMENTER = False
×
53

54
try:
1✔
55
    from privaterelay.glean.server_events import GLEAN_EVENT_MOZLOG_TYPE
1✔
56
except ImportError:
×
57
    # File may not be generated yet. Will be checked at initialization
58
    GLEAN_EVENT_MOZLOG_TYPE = "glean-server-event"
×
59

60
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
61
BASE_DIR: str = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1✔
62
TMP_DIR = os.path.join(BASE_DIR, "tmp")
1✔
63
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
1✔
64

65
# Quick-start development settings - unsuitable for production
66
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
67

68
# defaulting to blank to be production-broken by default
69
SECRET_KEY = config("SECRET_KEY", None)
1✔
70
SECRET_KEY_FALLBACKS = config("SECRET_KEY_FALLBACKS", "", cast=Csv())
1✔
71
SITE_ORIGIN: str | None = config("SITE_ORIGIN", None)
1✔
72

73
ORIGIN_CHANNEL_MAP: dict[str, RELAY_CHANNEL_NAME] = {
1✔
74
    "http://127.0.0.1:8000": "local",
75
    "https://dev.fxprivaterelay.nonprod.cloudops.mozgcp.net": "dev",
76
    "https://stage.fxprivaterelay.nonprod.cloudops.mozgcp.net": "stage",
77
    "https://relay.firefox.com": "prod",
78
}
79
RELAY_CHANNEL: RELAY_CHANNEL_NAME = cast(
1✔
80
    RELAY_CHANNEL_NAME,
81
    config(
82
        "RELAY_CHANNEL",
83
        default=ORIGIN_CHANNEL_MAP.get(SITE_ORIGIN or "", "local"),
84
        cast=Choices(get_args(RELAY_CHANNEL_NAME), cast=str),
85
    ),
86
)
87

88
DEBUG = config("DEBUG", False, cast=bool)
1✔
89
if DEBUG:
1!
90
    INTERNAL_IPS = config("DJANGO_INTERNAL_IPS", default="", cast=Csv())
1✔
91
IN_PYTEST: bool = "pytest" in sys.modules
1✔
92
USE_SILK = DEBUG and HAS_SILK and not IN_PYTEST
1✔
93

94
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
95
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
1✔
96
SECURE_SSL_HOST = config("DJANGO_SECURE_SSL_HOST", None)
1✔
97
SECURE_SSL_REDIRECT = config("DJANGO_SECURE_SSL_REDIRECT", False, cast=bool)
1✔
98
SECURE_REDIRECT_EXEMPT = [
1✔
99
    r"^__version__",
100
    r"^__heartbeat__",
101
    r"^__lbheartbeat__",
102
]
103
SECURE_HSTS_INCLUDE_SUBDOMAINS = config(
1✔
104
    "DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS", False, cast=bool
105
)
106
SECURE_HSTS_PRELOAD = config("DJANGO_SECURE_HSTS_PRELOAD", False, cast=bool)
1✔
107
SECURE_HSTS_SECONDS = config("DJANGO_SECURE_HSTS_SECONDS", None)
1✔
108
SECURE_BROWSER_XSS_FILTER = config("DJANGO_SECURE_BROWSER_XSS_FILTER", True)
1✔
109
SESSION_COOKIE_SECURE = config("DJANGO_SESSION_COOKIE_SECURE", False, cast=bool)
1✔
110
CSRF_COOKIE_SECURE = config("DJANGO_CSRF_COOKIE_SECURE", False, cast=bool)
1✔
111

112
#
113
# Setup CSP
114
#
115

116
BASKET_ORIGIN = config("BASKET_ORIGIN", "https://basket.mozilla.org")
1✔
117

118
# maps FxA / Mozilla account profile hosts to respective hosts for CSP
119
FXA_BASE_ORIGIN: str = config("FXA_BASE_ORIGIN", "https://accounts.firefox.com")
1✔
120
if FXA_BASE_ORIGIN == "https://accounts.firefox.com":
1!
121
    _AVATAR_IMG_SRC = [
×
122
        "firefoxusercontent.com",
123
        "https://profile.accounts.firefox.com",
124
    ]
125
    _ACCOUNT_CONNECT_SRC = [FXA_BASE_ORIGIN]
×
126
else:
127
    if not FXA_BASE_ORIGIN == "https://accounts.stage.mozaws.net":
1!
128
        raise ValueError(
×
129
            "FXA_BASE_ORIGIN must be either https://accounts.firefox.com or https://accounts.stage.mozaws.net"
130
        )
131
    _AVATAR_IMG_SRC = [
1✔
132
        "mozillausercontent.com",
133
        "https://profile.stage.mozaws.net",
134
    ]
135
    _ACCOUNT_CONNECT_SRC = [
1✔
136
        FXA_BASE_ORIGIN,
137
        # fxaFlowTracker.ts will try this if runtimeData is slow
138
        "https://accounts.firefox.com",
139
    ]
140

141
API_DOCS_ENABLED = config("API_DOCS_ENABLED", False, cast=bool) or DEBUG
1✔
142
_CSP_SCRIPT_INLINE = API_DOCS_ENABLED or USE_SILK
1✔
143

144
# When running locally, styles might get refreshed while the server is running, so their
145
# hashes would get oudated. Hence, we just allow all of them.
146
_CSP_STYLE_INLINE = API_DOCS_ENABLED or RELAY_CHANNEL == "local"
1✔
147

148
if API_DOCS_ENABLED:
1!
149
    _API_DOCS_CSP_IMG_SRC = ["data:", "https://cdn.redoc.ly"]
1✔
150
    _API_DOCS_CSP_STYLE_SRC = ["https://fonts.googleapis.com"]
1✔
151
    _API_DOCS_CSP_FONT_SRC = ["https://fonts.gstatic.com"]
1✔
152
    _API_DOCS_CSP_WORKER_SRC = ["blob:"]
1✔
153
else:
154
    _API_DOCS_CSP_IMG_SRC = []
×
155
    _API_DOCS_CSP_STYLE_SRC = []
×
156
    _API_DOCS_CSP_FONT_SRC = []
×
157
    _API_DOCS_CSP_WORKER_SRC = []
×
158

159
# Next.js dynamically inserts the relevant styles when switching pages,
160
# by injecting them as inline styles. We need to explicitly allow those styles
161
# in our Content Security Policy.
162
_CSP_STYLE_HASHES: list[str] = []
1✔
163
if _CSP_STYLE_INLINE:
1!
164
    # 'unsafe-inline' is not compatible with hash sources
165
    _CSP_STYLE_HASHES = []
1✔
166
else:
167
    # When running in production, we want to disallow inline styles that are
168
    # not set by us, so we use an explicit allowlist with the hashes of the
169
    # styles generated by Next.js.
170
    _next_css_path = Path(STATIC_ROOT) / "_next" / "static" / "css"
×
171
    for path in _next_css_path.glob("*.css"):
×
172
        # Use sha256 hashes, to keep in sync with Chrome.
173
        # When CSP rules fail in Chrome, it provides the sha256 hash that would
174
        # have matched, useful for debugging.
175
        content = open(path, "rb").read()
×
176
        the_hash = base64.b64encode(sha256(content).digest()).decode()
×
177
        _CSP_STYLE_HASHES.append(f"'sha256-{the_hash}'")
×
178
    _CSP_STYLE_HASHES.sort()
×
179

180
    # Add the hash for an empty string (sha256-47DEQp...)
181
    # next,js injects an empty style element and then adds the content.
182
    # This hash avoids a spurious CSP error.
183
    empty_hash = base64.b64encode(sha256().digest()).decode()
×
184
    _CSP_STYLE_HASHES.append(f"'sha256-{empty_hash}'")
×
185

186
CSP_DEFAULT_SRC = ["'self'"]
1✔
187
CSP_CONNECT_SRC = [
1✔
188
    "'self'",
189
    "https://www.google-analytics.com/",
190
    "https://location.services.mozilla.com",
191
    "https://api.stripe.com",
192
    BASKET_ORIGIN,
193
] + _ACCOUNT_CONNECT_SRC
194
CSP_FONT_SRC = ["'self'"] + _API_DOCS_CSP_FONT_SRC + ["https://relay.firefox.com/"]
1✔
195
CSP_IMG_SRC = ["'self'"] + _AVATAR_IMG_SRC + _API_DOCS_CSP_IMG_SRC
1✔
196
CSP_SCRIPT_SRC = (
1✔
197
    ["'self'"]
198
    + (["'unsafe-inline'"] if _CSP_SCRIPT_INLINE else [])
199
    + [
200
        "https://www.google-analytics.com/",
201
        "https://js.stripe.com/",
202
    ]
203
)
204
CSP_WORKER_SRC = _API_DOCS_CSP_WORKER_SRC or None
1✔
205
CSP_OBJECT_SRC = ["'none'"]
1✔
206
CSP_FRAME_SRC = ["https://js.stripe.com", "https://hooks.stripe.com"]
1✔
207
CSP_STYLE_SRC = (
1✔
208
    ["'self'"]
209
    + (["'unsafe-inline'"] if _CSP_STYLE_INLINE else [])
210
    + _API_DOCS_CSP_STYLE_SRC
211
    + _CSP_STYLE_HASHES
212
)
213
CSP_REPORT_URI = config("CSP_REPORT_URI", "")
1✔
214

215
REFERRER_POLICY = "strict-origin-when-cross-origin"
1✔
216

217
ALLOWED_HOSTS: list[str] = []
1✔
218
DJANGO_ALLOWED_HOSTS = config("DJANGO_ALLOWED_HOST", "", cast=Csv())
1✔
219
if DJANGO_ALLOWED_HOSTS:
1!
220
    ALLOWED_HOSTS += DJANGO_ALLOWED_HOSTS
×
221
DJANGO_ALLOWED_SUBNET = config("DJANGO_ALLOWED_SUBNET", None)
1✔
222
if DJANGO_ALLOWED_SUBNET:
1!
223
    ALLOWED_HOSTS += [str(ip) for ip in ipaddress.IPv4Network(DJANGO_ALLOWED_SUBNET)]
×
224

225

226
# Get our backing resource configs to check if we should install the app
227
ADMIN_ENABLED = config("ADMIN_ENABLED", False, cast=bool)
1✔
228

229

230
AWS_REGION: str | None = config("AWS_REGION", None)
1✔
231
AWS_ACCESS_KEY_ID = config("AWS_ACCESS_KEY_ID", None)
1✔
232
AWS_SECRET_ACCESS_KEY = config("AWS_SECRET_ACCESS_KEY", None)
1✔
233
AWS_SNS_TOPIC = set(config("AWS_SNS_TOPIC", "", cast=Csv()))
1✔
234
AWS_SNS_KEY_CACHE = config("AWS_SNS_KEY_CACHE", "default")
1✔
235
AWS_SES_CONFIGSET: str | None = config("AWS_SES_CONFIGSET", None)
1✔
236
AWS_SQS_EMAIL_QUEUE_URL = config("AWS_SQS_EMAIL_QUEUE_URL", None)
1✔
237
AWS_SQS_EMAIL_DLQ_URL = config("AWS_SQS_EMAIL_DLQ_URL", None)
1✔
238

239
# Dead-Letter Queue (DLQ) for SNS push subscription
240
AWS_SQS_QUEUE_URL = config("AWS_SQS_QUEUE_URL", None)
1✔
241

242
RELAY_FROM_ADDRESS: str | None = config("RELAY_FROM_ADDRESS", None)
1✔
243
GOOGLE_ANALYTICS_ID = config("GOOGLE_ANALYTICS_ID", None)
1✔
244
GOOGLE_APPLICATION_CREDENTIALS: str = config("GOOGLE_APPLICATION_CREDENTIALS", "")
1✔
245
GOOGLE_CLOUD_PROFILER_CREDENTIALS_B64: str = config(
1✔
246
    "GOOGLE_CLOUD_PROFILER_CREDENTIALS_B64", ""
247
)
248
INCLUDE_VPN_BANNER = config("INCLUDE_VPN_BANNER", False, cast=bool)
1✔
249
RECRUITMENT_BANNER_LINK = config("RECRUITMENT_BANNER_LINK", None)
1✔
250
RECRUITMENT_BANNER_TEXT = config("RECRUITMENT_BANNER_TEXT", None)
1✔
251
RECRUITMENT_EMAIL_BANNER_TEXT = config("RECRUITMENT_EMAIL_BANNER_TEXT", None)
1✔
252
RECRUITMENT_EMAIL_BANNER_LINK = config("RECRUITMENT_EMAIL_BANNER_LINK", None)
1✔
253

254
PHONES_ENABLED: bool = config("PHONES_ENABLED", False, cast=bool)
1✔
255
PHONES_NO_CLIENT_CALLS_IN_TEST = False  # Override in tests that do not test clients
1✔
256
TWILIO_ACCOUNT_SID: str | None = config("TWILIO_ACCOUNT_SID", None)
1✔
257
TWILIO_AUTH_TOKEN: str | None = config("TWILIO_AUTH_TOKEN", None)
1✔
258
TWILIO_MAIN_NUMBER: str | None = config("TWILIO_MAIN_NUMBER", None)
1✔
259
TWILIO_SMS_APPLICATION_SID: str | None = config("TWILIO_SMS_APPLICATION_SID", None)
1✔
260
TWILIO_MESSAGING_SERVICE_SID: list[str] = config(
1✔
261
    "TWILIO_MESSAGING_SERVICE_SID", "", cast=Csv()
262
)
263
TWILIO_TEST_ACCOUNT_SID: str | None = config("TWILIO_TEST_ACCOUNT_SID", None)
1✔
264
TWILIO_TEST_AUTH_TOKEN: str | None = config("TWILIO_TEST_AUTH_TOKEN", None)
1✔
265
TWILIO_ALLOWED_COUNTRY_CODES = {
1✔
266
    code.upper() for code in config("TWILIO_ALLOWED_COUNTRY_CODES", "US,CA", cast=Csv())
267
}
268
MAX_MINUTES_TO_VERIFY_REAL_PHONE: int = config(
1✔
269
    "MAX_MINUTES_TO_VERIFY_REAL_PHONE", 5, cast=int
270
)
271
MAX_TEXTS_PER_BILLING_CYCLE: int = config("MAX_TEXTS_PER_BILLING_CYCLE", 75, cast=int)
1✔
272
MAX_MINUTES_PER_BILLING_CYCLE: int = config(
1✔
273
    "MAX_MINUTES_PER_BILLING_CYCLE", 50, cast=int
274
)
275
DAYS_PER_BILLING_CYCLE = config("DAYS_PER_BILLING_CYCLE", 30, cast=int)
1✔
276
MAX_DAYS_IN_MONTH = 31
1✔
277
IQ_ENABLED = config("IQ_ENABLED", False, cast=bool)
1✔
278
IQ_FOR_VERIFICATION: bool = config("IQ_FOR_VERIFICATION", False, cast=bool)
1✔
279
IQ_FOR_NEW_NUMBERS = config("IQ_FOR_NEW_NUMBERS", False, cast=bool)
1✔
280
IQ_MAIN_NUMBER: str = config("IQ_MAIN_NUMBER", "")
1✔
281
IQ_OUTBOUND_API_KEY: str = config("IQ_OUTBOUND_API_KEY", "")
1✔
282
IQ_INBOUND_API_KEY = config("IQ_INBOUND_API_KEY", "")
1✔
283
IQ_MESSAGE_API_ORIGIN = config(
1✔
284
    "IQ_MESSAGE_API_ORIGIN", "https://messagebroker.inteliquent.com"
285
)
286
IQ_MESSAGE_PATH = "/msgbroker/rest/publishMessages"
1✔
287
IQ_PUBLISH_MESSAGE_URL: str = f"{IQ_MESSAGE_API_ORIGIN}{IQ_MESSAGE_PATH}"
1✔
288

289
DJANGO_STATSD_ENABLED = config("DJANGO_STATSD_ENABLED", False, cast=bool)
1✔
290
STATSD_DEBUG = config("STATSD_DEBUG", False, cast=bool)
1✔
291
STATSD_ENABLED: bool = DJANGO_STATSD_ENABLED or STATSD_DEBUG
1✔
292
STATSD_HOST = config("DJANGO_STATSD_HOST", "127.0.0.1")
1✔
293
STATSD_PORT = config("DJANGO_STATSD_PORT", "8125")
1✔
294
STATSD_PREFIX = config("DJANGO_STATSD_PREFIX", "fx.private.relay")
1✔
295

296
SERVE_ADDON = config("SERVE_ADDON", None)
1✔
297

298
# Application definition
299
INSTALLED_APPS = [
1✔
300
    "whitenoise.runserver_nostatic",
301
    "django.contrib.staticfiles",
302
    "django.contrib.auth",
303
    "django.contrib.contenttypes",
304
    "django.contrib.sessions",
305
    "django.contrib.messages",
306
    "django.contrib.sites",
307
    "django_filters",
308
    "django_ftl.apps.DjangoFtlConfig",
309
    "dockerflow.django",
310
    "allauth",
311
    "allauth.account",
312
    "allauth.socialaccount",
313
    "allauth.socialaccount.providers.fxa",
314
    "rest_framework",
315
    "rest_framework.authtoken",
316
    "corsheaders",
317
    "waffle",
318
    "privaterelay.apps.PrivateRelayConfig",
319
    "api.apps.ApiConfig",
320
]
321

322
if API_DOCS_ENABLED:
1!
323
    INSTALLED_APPS += [
1✔
324
        "drf_spectacular",
325
        "drf_spectacular_sidecar",
326
    ]
327

328
if DEBUG:
1!
329
    INSTALLED_APPS += [
1✔
330
        "debug_toolbar",
331
    ]
332

333
if USE_SILK:
1!
334
    INSTALLED_APPS.append("silk")
×
335

336
if ADMIN_ENABLED:
1!
337
    INSTALLED_APPS += [
×
338
        "django.contrib.admin",
339
    ]
340

341
if AWS_SES_CONFIGSET and AWS_SNS_TOPIC:
1!
342
    INSTALLED_APPS += [
1✔
343
        "emails.apps.EmailsConfig",
344
    ]
345

346
if PHONES_ENABLED:
1!
347
    INSTALLED_APPS += [
1✔
348
        "phones.apps.PhonesConfig",
349
    ]
350

351

352
# statsd middleware has to be first to catch errors in everything else
353
def _get_initial_middleware() -> list[str]:
1✔
354
    if STATSD_ENABLED:
1!
355
        return [
×
356
            "privaterelay.middleware.ResponseMetrics",
357
        ]
358
    return []
1✔
359

360

361
MIDDLEWARE = _get_initial_middleware()
1✔
362

363
if USE_SILK:
1!
364
    MIDDLEWARE.append("silk.middleware.SilkyMiddleware")
×
365
if DEBUG:
1!
366
    MIDDLEWARE.append("debug_toolbar.middleware.DebugToolbarMiddleware")
1✔
367

368
MIDDLEWARE += [
1✔
369
    "django.middleware.security.SecurityMiddleware",
370
    "csp.middleware.CSPMiddleware",
371
    "privaterelay.middleware.RedirectRootIfLoggedIn",
372
    "privaterelay.middleware.RelayStaticFilesMiddleware",
373
    "django.contrib.sessions.middleware.SessionMiddleware",
374
    "corsheaders.middleware.CorsMiddleware",
375
    "django.middleware.common.CommonMiddleware",
376
    "django.middleware.csrf.CsrfViewMiddleware",
377
    "django.contrib.auth.middleware.AuthenticationMiddleware",
378
    "django.contrib.messages.middleware.MessageMiddleware",
379
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
380
    "django.middleware.locale.LocaleMiddleware",
381
    "allauth.account.middleware.AccountMiddleware",
382
    "django_ftl.middleware.activate_from_request_language_code",
383
    "django_referrer_policy.middleware.ReferrerPolicyMiddleware",
384
    "dockerflow.django.middleware.DockerflowMiddleware",
385
    "waffle.middleware.WaffleMiddleware",
386
    "privaterelay.middleware.AddDetectedCountryToRequestAndResponseHeaders",
387
    "privaterelay.middleware.StoreFirstVisit",
388
]
389

390
if HAS_SQLCOMMENTER:
1!
391
    MIDDLEWARE.append("google.cloud.sqlcommenter.django.middleware.SqlCommenter")
1✔
392

393
ROOT_URLCONF = "privaterelay.urls"
1✔
394

395
TEMPLATES = [
1✔
396
    {
397
        "BACKEND": "django.template.backends.django.DjangoTemplates",
398
        "DIRS": [
399
            os.path.join(BASE_DIR, "privaterelay", "templates"),
400
        ],
401
        "APP_DIRS": True,
402
        "OPTIONS": {
403
            "context_processors": [
404
                "django.template.context_processors.debug",
405
                "django.template.context_processors.request",
406
                "django.contrib.auth.context_processors.auth",
407
                "django.contrib.messages.context_processors.messages",
408
            ],
409
        },
410
    },
411
]
412

413
RELAY_FIREFOX_DOMAIN: str = config("RELAY_FIREFOX_DOMAIN", "relay.firefox.com")
1✔
414
MOZMAIL_DOMAIN: str = config("MOZMAIL_DOMAIN", "mozmail.com")
1✔
415
MAX_NUM_FREE_ALIASES: int = config("MAX_NUM_FREE_ALIASES", 5, cast=int)
1✔
416
PERIODICAL_PREMIUM_PROD_ID: str = config("PERIODICAL_PREMIUM_PROD_ID", "")
1✔
417
PREMIUM_PLAN_ID_US_MONTHLY: str = config(
1✔
418
    "PREMIUM_PLAN_ID_US_MONTHLY", "price_1LXUcnJNcmPzuWtRpbNOajYS"
419
)
420
PREMIUM_PLAN_ID_US_YEARLY: str = config(
1✔
421
    "PREMIUM_PLAN_ID_US_YEARLY", "price_1LXUdlJNcmPzuWtRKTYg7mpZ"
422
)
423
PHONE_PROD_ID = config("PHONE_PROD_ID", "")
1✔
424
PHONE_PLAN_ID_US_MONTHLY: str = config(
1✔
425
    "PHONE_PLAN_ID_US_MONTHLY", "price_1Li0w8JNcmPzuWtR2rGU80P3"
426
)
427
PHONE_PLAN_ID_US_YEARLY: str = config(
1✔
428
    "PHONE_PLAN_ID_US_YEARLY", "price_1Li15WJNcmPzuWtRIh0F4VwP"
429
)
430
BUNDLE_PROD_ID = config("BUNDLE_PROD_ID", "")
1✔
431
BUNDLE_PLAN_ID_US: str = config("BUNDLE_PLAN_ID_US", "price_1LwoSDJNcmPzuWtR6wPJZeoh")
1✔
432

433
SUBSCRIPTIONS_WITH_UNLIMITED: list[str] = config(
1✔
434
    "SUBSCRIPTIONS_WITH_UNLIMITED", default="", cast=Csv()
435
)
436
SUBSCRIPTIONS_WITH_PHONE: list[str] = config(
1✔
437
    "SUBSCRIPTIONS_WITH_PHONE", default="", cast=Csv()
438
)
439
SUBSCRIPTIONS_WITH_VPN: list[str] = config(
1✔
440
    "SUBSCRIPTIONS_WITH_VPN", default="", cast=Csv()
441
)
442

443
MAX_ONBOARDING_AVAILABLE = config("MAX_ONBOARDING_AVAILABLE", 0, cast=int)
1✔
444
MAX_ONBOARDING_FREE_AVAILABLE = config("MAX_ONBOARDING_FREE_AVAILABLE", 3, cast=int)
1✔
445

446
MAX_ADDRESS_CREATION_PER_DAY = config("MAX_ADDRESS_CREATION_PER_DAY", 100, cast=int)
1✔
447
MAX_REPLIES_PER_DAY = config("MAX_REPLIES_PER_DAY", 100, cast=int)
1✔
448
MAX_FORWARDED_PER_DAY = config("MAX_FORWARDED_PER_DAY", 1000, cast=int)
1✔
449
MAX_FORWARDED_EMAIL_SIZE_PER_DAY = config(
1✔
450
    "MAX_FORWARDED_EMAIL_SIZE_PER_DAY", 1_000_000_000, cast=int
451
)
452
PREMIUM_FEATURE_PAUSED_DAYS: int = config(
1✔
453
    "ACCOUNT_PREMIUM_FEATURE_PAUSED_DAYS", 1, cast=int
454
)
455

456
SOFT_BOUNCE_ALLOWED_DAYS: int = config("SOFT_BOUNCE_ALLOWED_DAYS", 1, cast=int)
1✔
457
HARD_BOUNCE_ALLOWED_DAYS: int = config("HARD_BOUNCE_ALLOWED_DAYS", 30, cast=int)
1✔
458

459
WSGI_APPLICATION = "privaterelay.wsgi.application"
1✔
460

461
# Database
462
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
463

464
DATABASES = {
1✔
465
    "default": dj_database_url.config(
466
        default="sqlite:///{}".format(os.path.join(BASE_DIR, "db.sqlite3"))
467
    )
468
}
469
# Optionally set a test database name.
470
# This is useful for forcing an on-disk database for SQLite.
471
TEST_DB_NAME = config("TEST_DB_NAME", "")
1✔
472
if TEST_DB_NAME:
1!
473
    DATABASES["default"]["TEST"] = {"NAME": TEST_DB_NAME}
×
474

475
REDIS_URL = config("REDIS_URL", "")
1✔
476
if REDIS_URL:
1!
477
    CACHES = {
×
478
        "default": {
479
            "BACKEND": "django_redis.cache.RedisCache",
480
            "LOCATION": REDIS_URL,
481
            "OPTIONS": {
482
                "CLIENT_CLASS": "django_redis.client.DefaultClient",
483
            },
484
        }
485
    }
486
    SESSION_ENGINE = "django.contrib.sessions.backends.cache"
×
487
    SESSION_CACHE_ALIAS = "default"
×
488
elif RELAY_CHANNEL == "local":
1!
489
    CACHES = {
1✔
490
        "default": {
491
            "BACKEND": "django.core.cache.backends.locmem.LocMemCache",
492
        }
493
    }
494

495
# Password validation
496
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
497
# only needed when admin UI is enabled
498
if ADMIN_ENABLED:
1!
499
    _DJANGO_PWD_VALIDATION = "django.contrib.auth.password_validation"  # noqa: E501, S105 (long line, possible password)
×
500
    AUTH_PASSWORD_VALIDATORS = [
×
501
        {"NAME": _DJANGO_PWD_VALIDATION + ".UserAttributeSimilarityValidator"},
502
        {"NAME": _DJANGO_PWD_VALIDATION + ".MinimumLengthValidator"},
503
        {"NAME": _DJANGO_PWD_VALIDATION + ".CommonPasswordValidator"},
504
        {"NAME": _DJANGO_PWD_VALIDATION + ".NumericPasswordValidator"},
505
    ]
506

507

508
# Internationalization
509
# https://docs.djangoproject.com/en/2.2/topics/i18n/
510

511
LANGUAGE_CODE = "en"
1✔
512

513
# Mozilla l10n directories use lang-locale language codes,
514
# so we need to add those to LANGUAGES so Django's LocaleMiddleware
515
# can find them.
516
LANGUAGES = DEFAULT_LANGUAGES + [
1✔
517
    ("zh-tw", "Chinese"),
518
    ("zh-cn", "Chinese"),
519
    ("es-es", "Spanish"),
520
    ("pt-pt", "Portuguese"),
521
    ("skr", "Saraiki"),
522
]
523

524
TIME_ZONE = "UTC"
1✔
525

526
USE_I18N = True
1✔
527

528

529
USE_TZ = True
1✔
530

531
STATICFILES_DIRS = [
1✔
532
    os.path.join(BASE_DIR, "frontend/out"),
533
]
534
# Static files (the front-end in /frontend/)
535
# https://whitenoise.evans.io/en/stable/django.html#using-whitenoise-with-webpack-browserify-latest-js-thing
536
STATIC_URL = "/"
1✔
537
if DEBUG:
1!
538
    # In production, we run collectstatic to index all static files.
539
    # However, when running locally, we want to automatically pick up
540
    # all files spewed out by `npm run watch` in /frontend/out,
541
    # and we're fine with the performance impact of that.
542
    WHITENOISE_ROOT = os.path.join(BASE_DIR, "frontend/out")
1✔
543
STORAGES = {
1✔
544
    "default": {
545
        "BACKEND": "django.core.files.storage.FileSystemStorage",
546
    },
547
    "staticfiles": {
548
        "BACKEND": "privaterelay.storage.RelayStaticFilesStorage",
549
    },
550
}
551

552
# Relay does not support user-uploaded files
553
MEDIA_ROOT = None
1✔
554
MEDIA_URL = None
1✔
555

556
WHITENOISE_INDEX_FILE = True
1✔
557

558

559
# See
560
# https://whitenoise.evans.io/en/stable/django.html#WHITENOISE_ADD_HEADERS_FUNCTION
561
# Intended to ensure that the homepage does not get cached in our CDN,
562
# so that the `RedirectRootIfLoggedIn` middleware can kick in for logged-in
563
# users.
564
def set_index_cache_control_headers(
1✔
565
    headers: wsgiref.headers.Headers, path: str, url: str
566
) -> None:
567
    if DEBUG:
1!
568
        home_path = os.path.join(BASE_DIR, "frontend/out", "index.html")
1✔
569
    else:
570
        home_path = os.path.join(STATIC_ROOT, "index.html")
×
571
    if path == home_path:
1✔
572
        headers["Cache-Control"] = "no-cache, public"
1✔
573

574

575
WHITENOISE_ADD_HEADERS_FUNCTION = set_index_cache_control_headers
1✔
576

577
SITE_ID = 1
1✔
578

579
AUTHENTICATION_BACKENDS = (
1✔
580
    "django.contrib.auth.backends.ModelBackend",
581
    "allauth.account.auth_backends.AuthenticationBackend",
582
)
583

584
SOCIALACCOUNT_PROVIDERS = {
1✔
585
    "fxa": {
586
        # Note: to request "profile" scope, must be a trusted Mozilla client
587
        "SCOPE": ["profile", "https://identity.mozilla.com/account/subscriptions"],
588
        "AUTH_PARAMS": {"access_type": "offline"},
589
        "OAUTH_ENDPOINT": config(
590
            "FXA_OAUTH_ENDPOINT", "https://oauth.accounts.firefox.com/v1"
591
        ),
592
        "PROFILE_ENDPOINT": config(
593
            "FXA_PROFILE_ENDPOINT", "https://profile.accounts.firefox.com/v1"
594
        ),
595
        "VERIFIED_EMAIL": True,  # Assume FxA primary email is verified
596
    }
597
}
598

599
SOCIALACCOUNT_EMAIL_VERIFICATION = "none"
1✔
600
SOCIALACCOUNT_AUTO_SIGNUP = True
1✔
601
SOCIALACCOUNT_LOGIN_ON_GET = True
1✔
602
SOCIALACCOUNT_STORE_TOKENS = True
1✔
603

604
ACCOUNT_ADAPTER = "privaterelay.allauth.AccountAdapter"
1✔
605
ACCOUNT_PRESERVE_USERNAME_CASING = False
1✔
606
ACCOUNT_USERNAME_REQUIRED = False
1✔
607

608
FXA_REQUESTS_TIMEOUT_SECONDS = config("FXA_REQUESTS_TIMEOUT_SECONDS", 1, cast=int)
1✔
609
FXA_SETTINGS_URL = config("FXA_SETTINGS_URL", f"{FXA_BASE_ORIGIN}/settings")
1✔
610
FXA_SUBSCRIPTIONS_URL = config(
1✔
611
    "FXA_SUBSCRIPTIONS_URL", f"{FXA_BASE_ORIGIN}/subscriptions"
612
)
613
# check https://mozilla.github.io/ecosystem-platform/api#tag/Subscriptions/operation/getOauthMozillasubscriptionsCustomerBillingandsubscriptions  # noqa: E501 (line too long)
614
FXA_ACCOUNTS_ENDPOINT = config(
1✔
615
    "FXA_ACCOUNTS_ENDPOINT",
616
    "https://api.accounts.firefox.com/v1",
617
)
618
FXA_SUPPORT_URL = config("FXA_SUPPORT_URL", f"{FXA_BASE_ORIGIN}/support/")
1✔
619

620
LOGGING = {
1✔
621
    "version": 1,
622
    "filters": {
623
        "request_id": {
624
            "()": "dockerflow.logging.RequestIdLogFilter",
625
        },
626
    },
627
    "formatters": {
628
        "json": {
629
            "()": "dockerflow.logging.JsonLogFormatter",
630
            "logger_name": "fx-private-relay",
631
        }
632
    },
633
    "handlers": {
634
        "console_out": {
635
            "level": "DEBUG",
636
            "class": "logging.StreamHandler",
637
            "stream": sys.stdout,
638
            "formatter": "json",
639
            "filters": ["request_id"],
640
        },
641
        "console_err": {
642
            "level": "DEBUG",
643
            "class": "logging.StreamHandler",
644
            "formatter": "json",
645
            "filters": ["request_id"],
646
        },
647
    },
648
    "loggers": {
649
        "root": {
650
            "handlers": ["console_err"],
651
            "level": "WARNING",
652
        },
653
        "request.summary": {
654
            "handlers": ["console_out"],
655
            "level": "DEBUG",
656
            # pytest's caplog fixture requires propagate=True
657
            # outside of pytest, use propagate=False to avoid double logs
658
            "propagate": IN_PYTEST,
659
        },
660
        "events": {
661
            "handlers": ["console_err"],
662
            "level": "WARNING",
663
            "propagate": IN_PYTEST,
664
        },
665
        "eventsinfo": {
666
            "handlers": ["console_out"],
667
            "level": "INFO",
668
            "propagate": IN_PYTEST,
669
        },
670
        "abusemetrics": {
671
            "handlers": ["console_out"],
672
            "level": "INFO",
673
            "propagate": IN_PYTEST,
674
        },
675
        "studymetrics": {
676
            "handlers": ["console_out"],
677
            "level": "INFO",
678
            "propagate": IN_PYTEST,
679
        },
680
        "markus": {
681
            "handlers": ["console_out"],
682
            "level": "DEBUG",
683
            "propagate": IN_PYTEST,
684
        },
685
        GLEAN_EVENT_MOZLOG_TYPE: {
686
            "handlers": ["console_out"],
687
            "level": "DEBUG",
688
            "propagate": IN_PYTEST,
689
        },
690
        "dockerflow": {
691
            "handlers": ["console_err"],
692
            "level": "WARNING",
693
            "propagate": IN_PYTEST,
694
        },
695
    },
696
}
697

698
DRF_RENDERERS = ["rest_framework.renderers.JSONRenderer"]
1✔
699
if DEBUG and not IN_PYTEST:
1!
700
    DRF_RENDERERS += [
×
701
        "rest_framework.renderers.BrowsableAPIRenderer",
702
    ]
703

704
FIRST_EMAIL_RATE_LIMIT = config("FIRST_EMAIL_RATE_LIMIT", "5/minute")
1✔
705
if IN_PYTEST or RELAY_CHANNEL in ["local", "dev"]:
1!
706
    FIRST_EMAIL_RATE_LIMIT = "1000/minute"
1✔
707

708
REST_FRAMEWORK = {
1✔
709
    "DEFAULT_AUTHENTICATION_CLASSES": [
710
        "api.authentication.FxaTokenAuthentication",
711
        "rest_framework.authentication.TokenAuthentication",
712
        "rest_framework.authentication.SessionAuthentication",
713
    ],
714
    "DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated"],
715
    "DEFAULT_RENDERER_CLASSES": DRF_RENDERERS,
716
    "DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"],
717
    "EXCEPTION_HANDLER": "api.views.relay_exception_handler",
718
}
719
if API_DOCS_ENABLED:
1!
720
    REST_FRAMEWORK["DEFAULT_SCHEMA_CLASS"] = "drf_spectacular.openapi.AutoSchema"
1✔
721

722
SPECTACULAR_SETTINGS = {
1✔
723
    "SWAGGER_UI_DIST": "SIDECAR",
724
    "SWAGGER_UI_FAVICON_HREF": "SIDECAR",
725
    "REDOC_DIST": "SIDECAR",
726
    "TITLE": "Firefox Relay API",
727
    "DESCRIPTION": (
728
        "Keep your email safe from hackers and trackers. This API is built with"
729
        " Django REST Framework and powers the Relay website UI, add-on,"
730
        " Firefox browser, and 3rd-party app integrations."
731
    ),
732
    "VERSION": "1.0",
733
    "SERVE_INCLUDE_SCHEMA": False,
734
    "PREPROCESSING_HOOKS": ["api.schema.preprocess_ignore_deprecated_paths"],
735
    "SORT_OPERATIONS": "api.schema.sort_by_tag",
736
}
737

738
if IN_PYTEST or RELAY_CHANNEL in ["local", "dev"]:
1!
739
    _DEFAULT_PHONE_RATE_LIMIT = "1000/minute"
1✔
740
else:
741
    _DEFAULT_PHONE_RATE_LIMIT = "5/minute"
×
742
PHONE_RATE_LIMIT = config("PHONE_RATE_LIMIT", _DEFAULT_PHONE_RATE_LIMIT)
1✔
743

744
# Turn on logging out on GET in development.
745
# This allows `/mock/logout/` in the front-end to clear the
746
# session cookie. Without this, after switching accounts in dev mode,
747
# then logging out again, API requests continue succeeding even without
748
# an auth token:
749
ACCOUNT_LOGOUT_ON_GET = DEBUG
1✔
750

751
# TODO: introduce an environment variable to control CORS_ALLOWED_ORIGINS
752
# https://mozilla-hub.atlassian.net/browse/MPP-3468
753
CORS_URLS_REGEX = r"^/api/"
1✔
754
CORS_ALLOWED_ORIGINS = [
1✔
755
    "https://vault.bitwarden.com",
756
    "https://vault.bitwarden.eu",
757
]
758
if RELAY_CHANNEL in ["dev", "stage"]:
1!
759
    CORS_ALLOWED_ORIGINS += [
×
760
        "https://vault.qa.bitwarden.pw",
761
        "https://vault.euqa.bitwarden.pw",
762
    ]
763
# Allow origins for each environment to help debug cors headers
764
if RELAY_CHANNEL == "local":
1!
765
    # In local dev, next runs on localhost and makes requests to /accounts/
766
    CORS_ALLOWED_ORIGINS += [
1✔
767
        "http://localhost:3000",
768
        "http://0.0.0.0:3000",
769
        "http://127.0.0.1:8000",
770
    ]
771
    CORS_URLS_REGEX = r"^/(api|accounts)/"
1✔
772
if RELAY_CHANNEL == "dev":
1!
773
    CORS_ALLOWED_ORIGINS += [
×
774
        "https://dev.fxprivaterelay.nonprod.cloudops.mozgcp.net",
775
    ]
776
if RELAY_CHANNEL == "stage":
1!
777
    CORS_ALLOWED_ORIGINS += [
×
778
        "https://stage.fxprivaterelay.nonprod.cloudops.mozgcp.net",
779
    ]
780

781
CSRF_TRUSTED_ORIGINS = []
1✔
782
if RELAY_CHANNEL == "local":
1!
783
    # In local development, the React UI can be served up from a different server
784
    # that needs to be allowed to make requests.
785
    # In production, the frontend is served by Django, is therefore on the same
786
    # origin and thus has access to the same cookies.
787
    CORS_ALLOW_CREDENTIALS = True
1✔
788
    SESSION_COOKIE_SAMESITE = None
1✔
789
    CSRF_TRUSTED_ORIGINS += [
1✔
790
        "http://localhost:3000",
791
        "http://0.0.0.0:3000",
792
    ]
793

794
SENTRY_RELEASE = config("SENTRY_RELEASE", "")
1✔
795
CIRCLE_SHA1 = config("CIRCLE_SHA1", "")
1✔
796
CIRCLE_TAG = config("CIRCLE_TAG", "")
1✔
797
CIRCLE_BRANCH = config("CIRCLE_BRANCH", "")
1✔
798

799
sentry_release: str | None = None
1✔
800
if SENTRY_RELEASE:
1!
801
    sentry_release = SENTRY_RELEASE
×
802
elif CIRCLE_TAG and CIRCLE_TAG != "unknown":
1!
803
    sentry_release = CIRCLE_TAG
1✔
804
elif (
×
805
    CIRCLE_SHA1
806
    and CIRCLE_SHA1 != "unknown"
807
    and CIRCLE_BRANCH
808
    and CIRCLE_BRANCH != "unknown"
809
):
810
    sentry_release = f"{CIRCLE_BRANCH}:{CIRCLE_SHA1}"
×
811

812
SENTRY_DEBUG = config("SENTRY_DEBUG", DEBUG, cast=bool)
1✔
813

814
SENTRY_ENVIRONMENT = config("SENTRY_ENVIRONMENT", RELAY_CHANNEL)
1✔
815
# Use "local" as default rather than "prod", to catch ngrok.io URLs
816
if SENTRY_ENVIRONMENT == "prod" and SITE_ORIGIN != "https://relay.firefox.com":
1!
817
    SENTRY_ENVIRONMENT = "local"
×
818

819
sentry_sdk.init(
1✔
820
    dsn=config("SENTRY_DSN", None),
821
    integrations=[DjangoIntegration(cache_spans=not DEBUG)],
822
    debug=SENTRY_DEBUG,
823
    include_local_variables=DEBUG,
824
    release=sentry_release,
825
    environment=SENTRY_ENVIRONMENT,
826
)
827
# Duplicates events for unhandled exceptions, but without useful tracebacks
828
ignore_logger("request.summary")
1✔
829
# Security scanner attempts, no action required
830
# Can be re-enabled when hostname allow list implemented at the load balancer
831
ignore_logger("django.security.DisallowedHost")
1✔
832
# Fluent errors, mostly when a translation is unavailable for the locale.
833
# It is more effective to process these from logs using BigQuery than to track
834
# as events in Sentry.
835
ignore_logger("django_ftl.message_errors")
1✔
836
# Security scanner attempts on Heroku dev, no action required
837
if RELAY_CHANNEL == "dev":
1!
838
    ignore_logger("django.security.SuspiciousFileOperation")
×
839

840

841
_MARKUS_BACKENDS: list[dict[str, Any]] = []
1✔
842
if DJANGO_STATSD_ENABLED:
1!
843
    _MARKUS_BACKENDS.append(
×
844
        {
845
            "class": "markus.backends.datadog.DatadogMetrics",
846
            "options": {
847
                "statsd_host": STATSD_HOST,
848
                "statsd_port": STATSD_PORT,
849
                "statsd_prefix": STATSD_PREFIX,
850
            },
851
        }
852
    )
853
if STATSD_DEBUG:
1!
854
    _MARKUS_BACKENDS.append(
×
855
        {
856
            "class": "markus.backends.logging.LoggingMetrics",
857
            "options": {
858
                "logger_name": "markus",
859
                "leader": "METRICS",
860
            },
861
        }
862
    )
863
markus.configure(backends=_MARKUS_BACKENDS)
1✔
864

865
if USE_SILK:
1!
866
    SILKY_PYTHON_PROFILER = True
×
867
    SILKY_PYTHON_PROFILER_BINARY = True
×
868
    SILKY_PYTHON_PROFILER_RESULT_PATH = ".silk-profiler"
×
869

870
# Settings for manage.py process_emails_from_sqs
871
PROCESS_EMAIL_BATCH_SIZE = config(
1✔
872
    "PROCESS_EMAIL_BATCH_SIZE", 10, cast=Choices(range(1, 11), cast=int)
873
)
874
PROCESS_EMAIL_DELETE_FAILED_MESSAGES = config(
1✔
875
    "PROCESS_EMAIL_DELETE_FAILED_MESSAGES", False, cast=bool
876
)
877
PROCESS_EMAIL_HEALTHCHECK_PATH = config(
1✔
878
    "PROCESS_EMAIL_HEALTHCHECK_PATH", os.path.join(TMP_DIR, "healthcheck.json")
879
)
880
PROCESS_EMAIL_MAX_SECONDS = config("PROCESS_EMAIL_MAX_SECONDS", 0, cast=int) or None
1✔
881
PROCESS_EMAIL_VERBOSITY = config(
1✔
882
    "PROCESS_EMAIL_VERBOSITY", 1, cast=Choices(range(0, 4), cast=int)
883
)
884
PROCESS_EMAIL_VISIBILITY_SECONDS = config(
1✔
885
    "PROCESS_EMAIL_VISIBILITY_SECONDS", 120, cast=int
886
)
887
PROCESS_EMAIL_WAIT_SECONDS = config("PROCESS_EMAIL_WAIT_SECONDS", 5, cast=int)
1✔
888
PROCESS_EMAIL_HEALTHCHECK_MAX_AGE = config(
1✔
889
    "PROCESS_EMAIL_HEALTHCHECK_MAX_AGE", 120, cast=int
890
)
891
PROCESS_EMAIL_MAX_SECONDS_PER_MESSAGE = config(
1✔
892
    "PROCESS_EMAIL_MAX_SECONDS_PER_MESSAGE",
893
    PROCESS_EMAIL_MAX_SECONDS or 120.0,
894
    cast=float,
895
)
896

897
# Django 3.2 switches default to BigAutoField
898
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
1✔
899

900
# python-dockerflow settings
901
DOCKERFLOW_VERSION_CALLBACK = "privaterelay.utils.get_version_info"
1✔
902
DOCKERFLOW_CHECKS = [
1✔
903
    "dockerflow.django.checks.check_database_connected",
904
    "dockerflow.django.checks.check_migrations_applied",
905
]
906
if REDIS_URL:
1!
907
    DOCKERFLOW_CHECKS.append("dockerflow.django.checks.check_redis_connected")
×
908
DOCKERFLOW_REQUEST_ID_HEADER_NAME = config("DOCKERFLOW_REQUEST_ID_HEADER_NAME", None)
1✔
909
SILENCED_SYSTEM_CHECKS = sorted(
1✔
910
    set(config("DJANGO_SILENCED_SYSTEM_CHECKS", default="", cast=Csv()))
911
    | {
912
        # (models.W040) SQLite does not support indexes with non-key columns.
913
        # RelayAddress index idx_ra_created_by_addon uses this for PostgreSQL.
914
        "models.W040",
915
    }
916
)
917

918
# django-ftl settings
919
AUTO_RELOAD_BUNDLES = False  # Requires pyinotify
1✔
920

921
# Patching for django-types
922
django_stubs_ext.monkeypatch()
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc