|
11 | 11 | """
|
12 | 12 |
|
13 | 13 | from pathlib import Path
|
| 14 | +import os |
14 | 15 |
|
15 | 16 | # Build paths inside the project like this: BASE_DIR / 'subdir'.
|
16 | 17 | BASE_DIR = Path(__file__).resolve().parent.parent
|
|
25 | 26 | # SECURITY WARNING: don't run with debug turned on in production!
|
26 | 27 | DEBUG = True
|
27 | 28 |
|
28 |
| -ALLOWED_HOSTS = [] |
| 29 | +ALLOWED_HOSTS = [ |
| 30 | + "127.0.0.1", |
| 31 | + "https://fantasy-forge.k8s.ing.he-arc.ch", |
| 32 | + ] |
29 | 33 |
|
30 | 34 |
|
31 | 35 | # Application definition
|
|
39 | 43 | 'django.contrib.staticfiles',
|
40 | 44 | 'fantasyforgeapp',
|
41 | 45 | 'rest_framework',
|
| 46 | + 'corsheaders', |
42 | 47 | ]
|
43 |
| - |
44 | 48 | MIDDLEWARE = [
|
| 49 | + 'corsheaders.middleware.CorsMiddleware', |
45 | 50 | 'django.middleware.security.SecurityMiddleware',
|
46 | 51 | 'django.contrib.sessions.middleware.SessionMiddleware',
|
47 | 52 | 'django.middleware.common.CommonMiddleware',
|
|
77 | 82 |
|
78 | 83 | DATABASES = {
|
79 | 84 | 'default': {
|
80 |
| - 'ENGINE': 'django.db.backends.sqlite3', |
81 |
| - 'NAME': BASE_DIR / 'db.sqlite3', |
| 85 | + 'ENGINE': 'django.db.backends.postgresql', |
| 86 | + 'NAME': os.getenv('DB_NAME'), |
| 87 | + 'USER': os.getenv('DB_USER'), |
| 88 | + 'PASSWORD': os.getenv('DB_PASSWORD'), |
| 89 | + 'HOST': os.getenv('DB_HOST', 'localhost'), # Default to localhost |
| 90 | + 'PORT': os.getenv('DB_PORT', '5432'), # Default to 5432 |
82 | 91 | }
|
83 | 92 | }
|
84 | 93 |
|
85 |
| - |
86 | 94 | # Password validation
|
87 | 95 | # https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
|
88 | 96 |
|
|
117 | 125 | # Static files (CSS, JavaScript, Images)
|
118 | 126 | # https://docs.djangoproject.com/en/5.1/howto/static-files/
|
119 | 127 |
|
120 |
| -STATIC_URL = 'static/' |
| 128 | +STATIC_URL = '/static/' |
121 | 129 |
|
122 | 130 | # Default primary key field type
|
123 | 131 | # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
124 | 132 |
|
125 | 133 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
| 134 | + |
| 135 | +# CORS settings |
| 136 | +CORS_ALLOWED_ORIGINS = [ |
| 137 | + 'http://localhost:5173', |
| 138 | + 'https://fantasy-forge.k8s.ing.he-arc.ch', |
| 139 | +] |
| 140 | + |
| 141 | +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' |
0 commit comments