|
2 | 2 | """ |
3 | 3 | Django settings for PolicyLens. |
4 | 4 |
|
5 | | -Environment is the source of truth. |
6 | | -- Local dev uses .env |
7 | | -- Docker Compose supplies env values |
8 | | -- CI sets env values explicitly |
| 5 | +Week 4 adds ML artefact directory configuration. |
9 | 6 | """ |
10 | 7 |
|
11 | 8 | from __future__ import annotations |
|
21 | 18 | DJANGO_SECRET_KEY=(str, ""), |
22 | 19 | DJANGO_ALLOWED_HOSTS=(str, "localhost,127.0.0.1"), |
23 | 20 | DATABASE_URL=(str, ""), |
| 21 | + ML_ACTIVE_MODEL_VERSION=(str, "v1_2026_01_13"), |
| 22 | + ML_SCORE_THRESHOLD=(float, 0.6), |
| 23 | + ML_ARTIFACT_DIR=(str, ""), # Optional override |
24 | 24 | ) |
25 | 25 |
|
26 | 26 | SECRET_KEY = env("DJANGO_SECRET_KEY") |
|
38 | 38 | "django.contrib.sessions", |
39 | 39 | "django.contrib.messages", |
40 | 40 | "django.contrib.staticfiles", |
41 | | - # Third-party |
42 | 41 | "rest_framework", |
43 | | - # Local apps |
44 | 42 | "policylens.apps.core", |
45 | 43 | "policylens.apps.claims", |
46 | 44 | ] |
|
101 | 99 |
|
102 | 100 | REST_FRAMEWORK = { |
103 | 101 | "DEFAULT_AUTHENTICATION_CLASSES": [ |
104 | | - "rest_framework.authentication.BasicAuthentication", |
105 | 102 | "rest_framework.authentication.SessionAuthentication", |
| 103 | + "rest_framework.authentication.BasicAuthentication", |
106 | 104 | ], |
107 | | - # Week 2: core workflow API is authenticated by default. |
108 | 105 | "DEFAULT_PERMISSION_CLASSES": [ |
109 | 106 | "rest_framework.permissions.IsAuthenticated", |
110 | 107 | ], |
111 | 108 | } |
| 109 | + |
| 110 | +# ML configuration |
| 111 | +ML_ACTIVE_MODEL_VERSION = env("ML_ACTIVE_MODEL_VERSION") |
| 112 | +ML_SCORE_THRESHOLD = float(env("ML_SCORE_THRESHOLD")) |
| 113 | + |
| 114 | +_ml_dir = env("ML_ARTIFACT_DIR") |
| 115 | +ML_ARTIFACT_DIR = _ml_dir if _ml_dir else str(BASE_DIR.parent / "artifacts" / "ml") |
0 commit comments