-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdev.py
117 lines (101 loc) · 3.31 KB
/
dev.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
import os
import sys
import warnings
os.environ.setdefault("DEBUG", "yes")
os.environ.setdefault("ALLOWED_HOSTS", "*")
os.environ.setdefault(
"SECRET_KEY", "django-insecure-$8s@b*ds4t84-q_2#c0j0506@!l2q6r5_pq5e!vm^_9c*#^66b"
)
os.environ.setdefault("IS_HTTPS", "no")
os.environ.setdefault("VERSION_TAG", "dev")
os.environ.setdefault("DB_NAME", "openklant"),
os.environ.setdefault("DB_USER", "openklant"),
os.environ.setdefault("DB_PASSWORD", "openklant"),
os.environ.setdefault("ENVIRONMENT", "development")
os.environ.setdefault("RELEASE", "dev")
os.environ.setdefault("LOG_REQUESTS", "no")
os.environ.setdefault("DISABLE_2FA", "yes")
from .base import * # noqa isort:skip
# Feel free to switch dev to sqlite3 for simple projects,
# os.environ.setdefault("DB_ENGINE", "django.db.backends.sqlite3")
#
# Standard Django settings.
#
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
LOGGING["loggers"].update(
{
"openklant": {
"handlers": ["console"],
"level": "DEBUG",
"propagate": True,
},
"django": {
"handlers": ["console"],
"level": "DEBUG",
"propagate": True,
},
"performance": {
"handlers": ["console"],
"level": "INFO",
"propagate": True,
},
#
# See: https://code.djangoproject.com/ticket/30554
# Autoreload logs excessively, turn it down a bit.
#
"django.utils.autoreload": {
"handlers": ["django"],
"level": "INFO",
"propagate": False,
},
}
)
if not LOG_QUERIES:
LOGGING["loggers"]["django.db.backends"]["handlers"] = ["django"]
# in memory cache and django-axes don't get along.
# https://django-axes.readthedocs.io/en/latest/configuration.html#known-configuration-problems
CACHES = {
"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"},
"axes": {"BACKEND": "django.core.cache.backends.dummy.DummyCache"},
"oidc": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"},
}
#
# Library settings
#
ELASTIC_APM["DEBUG"] = True
# Django debug toolbar
INSTALLED_APPS += ["debug_toolbar"]
MIDDLEWARE += [
"debug_toolbar.middleware.DebugToolbarMiddleware",
]
INTERNAL_IPS = ("127.0.0.1",)
DEBUG_TOOLBAR_CONFIG = {"INTERCEPT_REDIRECTS": False}
DEBUG_TOOLBAR_PANELS = [
"debug_toolbar.panels.versions.VersionsPanel",
"debug_toolbar.panels.timer.TimerPanel",
"debug_toolbar.panels.settings.SettingsPanel",
"debug_toolbar.panels.headers.HeadersPanel",
"debug_toolbar.panels.request.RequestPanel",
"debug_toolbar.panels.sql.SQLPanel",
"debug_toolbar.panels.staticfiles.StaticFilesPanel",
"debug_toolbar.panels.templates.TemplatesPanel",
"debug_toolbar.panels.cache.CachePanel",
"debug_toolbar.panels.signals.SignalsPanel",
"debug_toolbar.panels.logging.LoggingPanel",
"debug_toolbar.panels.redirects.RedirectsPanel",
"debug_toolbar.panels.profiling.ProfilingPanel",
]
# THOU SHALT NOT USE NAIVE DATETIMES
warnings.filterwarnings(
"error",
r"DateTimeField .* received a naive datetime",
RuntimeWarning,
r"django\.db\.models\.fields",
)
if "test" in sys.argv:
NOTIFICATIONS_DISABLED = True
# Override settings with local settings.
try:
from .local import * # noqa
except ImportError:
pass