|
43 | 43 |
|
44 | 44 | # SECURITY WARNING: don't run with debug turned on in production! |
45 | 45 | DEBUG = env.bool("DEBUG", default=False) |
| 46 | +PROD_ENV = env.bool("PROD_ENV", default=False) |
| 47 | + |
46 | 48 | if DEBUG is True: |
47 | 49 | STATICFILES_FINDERS.append("sass_processor.finders.CssFinder") |
48 | 50 | SASS_PROCESSOR_ROOT = STATIC_ROOT |
|
262 | 264 | "orm": "default", |
263 | 265 | } |
264 | 266 |
|
265 | | -# SECURITY |
266 | | -# https://docs.djangoproject.com/en/dev/ref/settings/#secure-ssl-redirect |
267 | | -SECURE_SSL_REDIRECT = env.bool("DJANGO_SECURE_SSL_REDIRECT", default=True) |
268 | | -# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-secure |
269 | | -SESSION_COOKIE_SECURE = True |
270 | | -# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-name |
271 | | -SESSION_COOKIE_NAME = "__Secure-sessionid" |
272 | | -# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-secure |
273 | | -CSRF_COOKIE_SECURE = True |
274 | | -# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-seconds |
275 | | -# TODO: set this to 60 seconds first and then to 518400 once you prove the former works |
276 | | -SECURE_HSTS_SECONDS = 60 |
277 | | -# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-include-subdomains |
278 | | -SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool( |
279 | | - "DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS", |
280 | | - default=True, |
281 | | -) |
282 | | -# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-preload |
283 | | -SECURE_HSTS_PRELOAD = env.bool("DJANGO_SECURE_HSTS_PRELOAD", default=True) |
284 | | -# https://docs.djangoproject.com/en/dev/ref/middleware/#x-content-type-options-nosniff |
285 | | -SECURE_CONTENT_TYPE_NOSNIFF = env.bool( |
286 | | - "DJANGO_SECURE_CONTENT_TYPE_NOSNIFF", |
287 | | - default=True, |
288 | | -) |
| 267 | +if PROD_ENV: |
| 268 | + # SECURITY |
| 269 | + # https://docs.djangoproject.com/en/dev/ref/settings/#secure-ssl-redirect |
| 270 | + SECURE_SSL_REDIRECT = env.bool("DJANGO_SECURE_SSL_REDIRECT", default=True) |
| 271 | + # https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-secure |
| 272 | + SESSION_COOKIE_SECURE = True |
| 273 | + # https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-name |
| 274 | + SESSION_COOKIE_NAME = "__Secure-sessionid" |
| 275 | + # https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-secure |
| 276 | + CSRF_COOKIE_SECURE = True |
| 277 | + # https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-seconds |
| 278 | + # TODO: set this to 60 seconds first and then to 518400 once you prove the former works |
| 279 | + SECURE_HSTS_SECONDS = 60 |
| 280 | + # https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-include-subdomains |
| 281 | + SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool( |
| 282 | + "DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS", |
| 283 | + default=True, |
| 284 | + ) |
| 285 | + # https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-preload |
| 286 | + SECURE_HSTS_PRELOAD = env.bool("DJANGO_SECURE_HSTS_PRELOAD", default=True) |
| 287 | + # https://docs.djangoproject.com/en/dev/ref/middleware/#x-content-type-options-nosniff |
| 288 | + SECURE_CONTENT_TYPE_NOSNIFF = env.bool( |
| 289 | + "DJANGO_SECURE_CONTENT_TYPE_NOSNIFF", |
| 290 | + default=True, |
| 291 | + ) |
0 commit comments