|
4 | 4 | from datetime import timedelta |
5 | 5 | from pathlib import Path |
6 | 6 |
|
7 | | -import sentry_sdk |
8 | 7 | from decouple import config |
9 | | -from sentry_sdk.integrations.django import DjangoIntegration |
10 | 8 |
|
11 | 9 | mimetypes.add_type("application/javascript", ".js", True) |
12 | 10 | mimetypes.add_type("text/css", ".css", True) |
|
18 | 16 |
|
19 | 17 | DEBUG = config("DEBUG", default=False, cast=bool) |
20 | 18 |
|
21 | | -SENTRY_DSN = config("SENTRY_DSN", default="", cast=str) |
22 | | - |
23 | 19 | AUTOPOSTING_ON = config("AUTOPOSTING_ON", default=False, cast=bool) |
24 | 20 |
|
25 | 21 | TELEGRAM_BOT_TOKEN = config("TELEGRAM_BOT_TOKEN", default="", cast=str) |
|
36 | 32 | "https://www.procollab.ru", |
37 | 33 | "https://app.procollab.ru", |
38 | 34 | "https://dev.procollab.ru", |
39 | | - "https://www.procollab.ru", |
40 | 35 | ] |
41 | 36 |
|
42 | 37 | ALLOWED_HOSTS = [ |
|
48 | 43 | "app.procollab.ru", |
49 | 44 | "dev.procollab.ru", |
50 | 45 | "procollab.ru", |
51 | | - "dev.procollab.ru", |
52 | 46 | "web", # From Docker |
53 | 47 | ] |
54 | 48 |
|
|
61 | 55 | "django.contrib.auth.hashers.ScryptPasswordHasher", |
62 | 56 | ] |
63 | 57 |
|
64 | | -# Application definition |
65 | | -if SENTRY_DSN: |
66 | | - sentry_sdk.init( |
67 | | - dsn=SENTRY_DSN, |
68 | | - integrations=[DjangoIntegration()], |
69 | | - release="dev" if DEBUG else "prod", |
70 | | - traces_sample_rate=1.0, |
71 | | - send_default_pii=True, |
72 | | - ) |
73 | | - |
74 | 58 | INSTALLED_APPS = [ |
75 | 59 | # daphne is required for channels, should be installed before django.contrib.static |
76 | 60 | "daphne", |
|
81 | 65 | "django.contrib.sessions", |
82 | 66 | "django.contrib.messages", |
83 | 67 | "django.contrib.staticfiles", |
84 | | - "debug_toolbar", |
85 | 68 | # My apps |
86 | 69 | "core.apps.CoreConfig", |
87 | 70 | "industries.apps.IndustriesConfig", |
|
125 | 108 | "django.contrib.auth.middleware.AuthenticationMiddleware", |
126 | 109 | "django.contrib.messages.middleware.MessageMiddleware", |
127 | 110 | "django.middleware.clickjacking.XFrameOptionsMiddleware", |
128 | | - "debug_toolbar.middleware.DebugToolbarMiddleware", |
129 | 111 | "core.log.middleware.CustomLoguruMiddleware", |
130 | 112 | ] |
131 | 113 |
|
|
145 | 127 |
|
146 | 128 | ROOT_URLCONF = "procollab.urls" |
147 | 129 |
|
| 130 | +SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") |
| 131 | +SECURE_SSL_REDIRECT = not DEBUG |
| 132 | + |
148 | 133 | TEMPLATES = [ |
149 | 134 | { |
150 | 135 | "BACKEND": "django.template.backends.django.DjangoTemplates", |
|
184 | 169 | RUNNING_TESTS = "test" in sys.argv |
185 | 170 |
|
186 | 171 | if DEBUG: |
| 172 | + INSTALLED_APPS.append("debug_toolbar") |
| 173 | + MIDDLEWARE.insert(-1, "debug_toolbar.middleware.DebugToolbarMiddleware") |
187 | 174 | DATABASES = { |
188 | 175 | "default": { |
189 | 176 | "ENGINE": "django.db.backends.sqlite3", |
190 | 177 | "NAME": "db.sqlite3", |
191 | 178 | } |
192 | 179 | } |
193 | 180 |
|
194 | | - # DATABASES = { |
195 | | - # "default": { |
196 | | - # "ENGINE": "django.db.backends.postgresql", |
197 | | - # "NAME": config("DATABASE_NAME", default="postgres", cast=str), |
198 | | - # "USER": config("DATABASE_USER", default="postgres", cast=str), |
199 | | - # "PASSWORD": config("DATABASE_PASSWORD", default="postgres", cast=str), |
200 | | - # "HOST": config("DATABASE_HOST", default="db", cast=str), |
201 | | - # "PORT": config("DATABASE_PORT", default="5432", cast=str), |
202 | | - # } |
203 | | - # } |
204 | | - |
205 | 181 | if RUNNING_TESTS: |
206 | 182 | CACHES = { |
207 | 183 | "default": { |
|
244 | 220 | "rest_framework.renderers.JSONRenderer", |
245 | 221 | ] |
246 | 222 |
|
247 | | - DB_SERVICE = config("DB_SERVICE", default="postgres", cast=str) |
248 | | - |
249 | 223 | DATABASES = { |
250 | 224 | "default": { |
251 | 225 | "ENGINE": "django.db.backends.postgresql", |
|
333 | 307 | if DEBUG: |
334 | 308 | SIMPLE_JWT["ACCESS_TOKEN_LIFETIME"] = timedelta(weeks=2) |
335 | 309 |
|
336 | | -SESSION_COOKIE_SECURE = False |
| 310 | +SESSION_COOKIE_SECURE = not DEBUG |
| 311 | +CSRF_COOKIE_SECURE = not DEBUG |
337 | 312 |
|
338 | 313 | EMAIL_BACKEND = "anymail.backends.unisender_go.EmailBackend" |
339 | 314 |
|
|
348 | 323 | }, |
349 | 324 | } |
350 | 325 |
|
351 | | -EMAIL_USE_TLS = True |
352 | | - |
353 | | -EMAIL_PORT = config("EMAIL_PORT", default=587, cast=int) |
354 | 326 | EMAIL_USER = config("EMAIL_USER", cast=str, default="example@mail.ru") |
355 | 327 |
|
356 | | -# EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" |
357 | | -# EMAIL_USE_TLS = True |
358 | | -# EMAIL_HOST = config("EMAIL_HOST", default="smtp.gmail.com", cast=str) |
359 | | -# EMAIL_PORT = config("EMAIL_PORT", default=587, cast=int) |
360 | | -# EMAIL_HOST_USER = config("EMAIL_USER", cast=str, default="example@mail.ru") |
361 | | -# EMAIL_USER = EMAIL_HOST_USER |
362 | | -# EMAIL_HOST_PASSWORD = config("EMAIL_PASSWORD", cast=str, default="password") |
363 | | - |
364 | 328 | SELECTEL_ACCOUNT_ID = config("SELECTEL_ACCOUNT_ID", cast=str, default="123456") |
365 | 329 | SELECTEL_CONTAINER_NAME = config( |
366 | 330 | "SELECTEL_CONTAINER_NAME", cast=str, default="procollab_media" |
|
387 | 351 | if DEBUG: |
388 | 352 | SELECTEL_SWIFT_URL += "debug/" |
389 | 353 |
|
390 | | -PROMETHEUS_LATENCY_BUCKETS = ( |
391 | | - 0.01, |
392 | | - 0.025, |
393 | | - 0.05, |
394 | | - 0.075, |
395 | | - 0.1, |
396 | | - 0.25, |
397 | | - 0.5, |
398 | | - 0.75, |
399 | | - 1.0, |
400 | | - 2.5, |
401 | | - 5.0, |
402 | | - 7.5, |
403 | | - 10.0, |
404 | | - 25.0, |
405 | | - 50.0, |
406 | | - 75.0, |
407 | | - float("inf"), |
408 | | -) |
409 | | - |
410 | 354 | DATA_UPLOAD_MAX_NUMBER_FIELDS = None # for mailing |
411 | 355 |
|
412 | 356 |
|
|
0 commit comments