From 49de2decca2f7afa85934f428b271ec418f5b695 Mon Sep 17 00:00:00 2001 From: jedi Date: Mon, 23 Oct 2023 00:11:50 +0200 Subject: [PATCH] use X-Forwarded-* headers in django config --- backend/backend/settings.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/backend/settings.py b/backend/backend/settings.py index 411c8f7..465665a 100644 --- a/backend/backend/settings.py +++ b/backend/backend/settings.py @@ -13,8 +13,6 @@ import os import dotenv from pathlib import Path -from django.contrib import staticfiles - # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -29,11 +27,10 @@ if SECRET_KEY is None: DEBUG = os.environ.get('DEBUG', 'False').lower() == 'true' -if DEBUG: - print('DEBUG mode is enabled') - # Application definition +TOOLSHED_VERSION = "0.0.0-dev.0" + INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', @@ -85,6 +82,9 @@ CSRF_TRUSTED_ORIGINS = ['https://' + host for host in ALLOWED_HOSTS] CORS_ALLOW_ALL_ORIGINS = True +USE_X_FORWARDED_HOST = True +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') + ROOT_URLCONF = 'backend.urls' TEMPLATES = [ @@ -177,4 +177,5 @@ STORAGES = { }, } +DATA_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 * 128 # 128 MB TEST_RUNNER = 'backend.test_runner.FastTestRunner'