|
| 1 | +import os |
| 2 | +from pathlib import Path |
| 3 | + |
| 4 | +BASE_DIR = Path(__file__).resolve().parent.parent |
| 5 | + |
| 6 | +DEBUG = True |
| 7 | + |
| 8 | +SECRET_KEY = "django-insecure-34q#9n1j46yc)+1c6&%$_$-ql%qxz^fzlf@0@1xm-zvroai1ju" |
| 9 | + |
| 10 | +INSTALLED_APPS = [ |
| 11 | + "django.contrib.admin", |
| 12 | + "django.contrib.auth", |
| 13 | + "django.contrib.contenttypes", |
| 14 | + "django.contrib.sessions", |
| 15 | + "django.contrib.messages", |
| 16 | + "django.contrib.staticfiles", |
| 17 | + "import_export", |
| 18 | + "import_db_default", |
| 19 | +] |
| 20 | + |
| 21 | +MIDDLEWARE = [ |
| 22 | + "django.middleware.security.SecurityMiddleware", |
| 23 | + "django.contrib.sessions.middleware.SessionMiddleware", |
| 24 | + "django.middleware.common.CommonMiddleware", |
| 25 | + "django.middleware.csrf.CsrfViewMiddleware", |
| 26 | + "django.contrib.auth.middleware.AuthenticationMiddleware", |
| 27 | + "django.contrib.messages.middleware.MessageMiddleware", |
| 28 | + "django.middleware.clickjacking.XFrameOptionsMiddleware", |
| 29 | +] |
| 30 | + |
| 31 | +ROOT_URLCONF = "import_db_default.urls" |
| 32 | + |
| 33 | +TEMPLATES = [ |
| 34 | + { |
| 35 | + "BACKEND": "django.template.backends.django.DjangoTemplates", |
| 36 | + "DIRS": [], |
| 37 | + "APP_DIRS": True, |
| 38 | + "OPTIONS": { |
| 39 | + "context_processors": [ |
| 40 | + "django.template.context_processors.debug", |
| 41 | + "django.template.context_processors.request", |
| 42 | + "django.contrib.auth.context_processors.auth", |
| 43 | + "django.contrib.messages.context_processors.messages", |
| 44 | + ], |
| 45 | + }, |
| 46 | + }, |
| 47 | +] |
| 48 | + |
| 49 | +WSGI_APPLICATION = "import_db_default.wsgi.application" |
| 50 | + |
| 51 | + |
| 52 | +# Database |
| 53 | +# https://docs.djangoproject.com/en/5.0/ref/settings/#databases |
| 54 | + |
| 55 | +DATABASES = { |
| 56 | + "default": { |
| 57 | + "ENGINE": "django.db.backends.postgresql", |
| 58 | + "NAME": os.environ.get("DB_NAME", "bugs"), |
| 59 | + "USER": os.environ.get("DB_USER", "postgres"), |
| 60 | + "PASSWORD": os.environ.get("DB_PASSWORD", None), |
| 61 | + "HOST": os.environ.get("DB_HOST", None), |
| 62 | + "PORT": int(os.environ["DB_PORT"]) if "DB_PORT" in os.environ else None, |
| 63 | + }, |
| 64 | +} |
| 65 | + |
| 66 | + |
| 67 | +# Authentication and password validation |
| 68 | +# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators |
| 69 | + |
| 70 | +AUTH_PASSWORD_VALIDATORS = [ |
| 71 | + { |
| 72 | + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", |
| 73 | + }, |
| 74 | + { |
| 75 | + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", |
| 76 | + }, |
| 77 | + { |
| 78 | + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", |
| 79 | + }, |
| 80 | + { |
| 81 | + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", |
| 82 | + }, |
| 83 | +] |
| 84 | + |
| 85 | + |
| 86 | +# Internationalization |
| 87 | +# https://docs.djangoproject.com/en/5.0/topics/i18n/ |
| 88 | + |
| 89 | +LANGUAGE_CODE = "en" |
| 90 | +USE_I18N = True |
| 91 | + |
| 92 | +TIME_ZONE = "Europe/Malta" |
| 93 | +USE_TZ = True |
| 94 | + |
| 95 | + |
| 96 | +# Static files (CSS, JavaScript, Images) |
| 97 | +# https://docs.djangoproject.com/en/5.0/howto/static-files/ |
| 98 | + |
| 99 | +STATIC_URL = "static/" |
| 100 | +MEDIA_URL = "media/" |
| 101 | + |
| 102 | +STATIC_ROOT = BASE_DIR.joinpath(os.environ.get("STATIC_ROOT", "local/static")) # target directory for "collectstatic" command (used only in production) |
| 103 | +MEDIA_ROOT = BASE_DIR.joinpath(os.environ.get("MEDIA_ROOT", "local/media")) # application-related media |
| 104 | + |
| 105 | + |
| 106 | +# Default primary key field type |
| 107 | +# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field |
| 108 | + |
| 109 | +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" |
0 commit comments