|
| 1 | +import os |
1 | 2 | from pathlib import Path |
2 | 3 |
|
| 4 | +from dotenv import load_dotenv |
| 5 | + |
| 6 | + |
3 | 7 | # Build paths inside the project like this: BASE_DIR / 'subdir'. |
4 | 8 | BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent |
5 | 9 | # Quick-start development settings - unsuitable for production |
6 | 10 | # See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ |
7 | 11 |
|
8 | | -# SECURITY WARNING: keep the secret key used in production secret! |
9 | | -SECRET_KEY = 'django-insecure-thdv&w5!x!cx0kb+iu3yym_(u4_vqb+jzrd5i5r#%2x19q63nh' |
10 | | - |
11 | | -# SECURITY WARNING: don't run with debug turned on in production! |
12 | | -DEBUG = True |
| 12 | +USER_SERVICE_ENV_PATH = os.path.join(BASE_DIR, '.envs', '.local', '.userservice') |
| 13 | +POSTGRES_ENV_PATH = os.path.join(BASE_DIR, '.envs', '.local', '.postgres') |
13 | 14 |
|
14 | | -ALLOWED_HOSTS = [] |
| 15 | +load_dotenv(USER_SERVICE_ENV_PATH) |
| 16 | +load_dotenv(POSTGRES_ENV_PATH) |
15 | 17 |
|
16 | 18 | # TicketFlow Application definition. |
17 | 19 |
|
|
70 | 72 | # ------------------------------------------------------------------------------ |
71 | 73 | # https://docs.djangoproject.com/en/dev/ref/settings/#authentication-backends |
72 | 74 | AUTHENTICATION_BACKENDS = [ |
73 | | - # Needed to login by username in Django admin, regardless of `allauth` |
| 75 | + # Needed to log in by username in Django admin, regardless of `allauth` |
74 | 76 | "django.contrib.auth.backends.ModelBackend", |
75 | 77 | ] |
76 | 78 | # https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model |
|
82 | 84 |
|
83 | 85 | WSGI_APPLICATION = 'config.wsgi.application' |
84 | 86 |
|
85 | | -# Database |
86 | | -# https://docs.djangoproject.com/en/5.1/ref/settings/#databases |
87 | | - |
| 87 | +# DATABASES |
| 88 | +# ------------------------------------------------------------------------------ |
| 89 | +# https://docs.djangoproject.com/en/dev/ref/settings/#databases |
88 | 90 | DATABASES = { |
89 | | - 'default': { |
90 | | - 'ENGINE': 'django.db.backends.sqlite3', |
91 | | - 'NAME': BASE_DIR / 'db.sqlite3', |
| 91 | + "default": { |
| 92 | + "ENGINE": "django.db.backends.postgresql", |
| 93 | + "NAME": os.getenv("POSTGRES_DB", "user_service_db"), |
| 94 | + "USER": os.getenv("POSTGRES_USER", "user_dev_local"), |
| 95 | + "PASSWORD": os.getenv("POSTGRES_PASSWORD", "@changeMe1234"), |
| 96 | + "HOST": os.getenv("POSTGRES_HOST", "localhost"), |
| 97 | + "PORT": os.getenv("POSTGRES_PORT", "5432"), |
92 | 98 | } |
93 | 99 | } |
94 | 100 |
|
|
0 commit comments