- Rewrote frontend from JSX to TypeScript (TSX) - AppLayout with MUI AppBar, ThemeProvider, CssBaseline - HomePage at / with dashboard metrics and recent updates - MetricsPanel with 4 metric cards (total, interviews, offers, rejection rate) - UpdateCard for each job update with status chip - LoadingSkeleton during data fetch - Error Alert on API failure - Create New Job Application button navigating to /applications/new - Vite proxy for /api → backend on :8000 - useDashboardData custom hook with concurrent fetch Closes #2
103 lines
2.6 KiB
Python
103 lines
2.6 KiB
Python
import os
|
|
from pathlib import Path
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
SECRET_KEY = os.environ.get(
|
|
"DJANGO_SECRET_KEY",
|
|
"django-insecure-change-me-in-production",
|
|
)
|
|
|
|
DEBUG = os.environ.get("DJANGO_DEBUG", "True").lower() in ("true", "1", "yes")
|
|
|
|
ALLOWED_HOSTS: list[str] = ["*"]
|
|
|
|
INSTALLED_APPS = [
|
|
"django.contrib.contenttypes",
|
|
"django.contrib.auth",
|
|
"django.contrib.sessions",
|
|
"django.contrib.admin",
|
|
"django.contrib.messages",
|
|
"django.contrib.staticfiles",
|
|
# Third-party
|
|
"rest_framework",
|
|
"corsheaders",
|
|
# Local
|
|
"jobs",
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
"corsheaders.middleware.CorsMiddleware",
|
|
"django.middleware.security.SecurityMiddleware",
|
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
"django.middleware.common.CommonMiddleware",
|
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
"django.contrib.messages.middleware.MessageMiddleware",
|
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
|
]
|
|
|
|
ROOT_URLCONF = "project.urls"
|
|
|
|
TEMPLATES = [
|
|
{
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
"DIRS": [],
|
|
"APP_DIRS": True,
|
|
"OPTIONS": {
|
|
"context_processors": [
|
|
"django.template.context_processors.debug",
|
|
"django.template.context_processors.request",
|
|
"django.contrib.auth.context_processors.auth",
|
|
"django.contrib.messages.context_processors.messages",
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = "project.wsgi.application"
|
|
|
|
# Parse DATABASE_URL
|
|
_database_url = os.environ.get(
|
|
"DATABASE_URL",
|
|
"postgres://jobtracker:***@localhost:5432/jobtracker",
|
|
)
|
|
|
|
# postgres://user:***@host:port/dbname → django settings dict
|
|
_db_parts = _database_url.replace("postgres://", "").split("@")
|
|
_credentials, _host_db = _db_parts[0], _db_parts[1]
|
|
_db_user, _db_pass = _credentials.split(":")
|
|
_host_port, _db_name = _host_db.split("/")
|
|
_db_host = _host_port.split(":")[0]
|
|
_db_port = _host_port.split(":")[1] if ":" in _host_port else "5432"
|
|
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.postgresql",
|
|
"NAME": _db_name,
|
|
"USER": _db_user,
|
|
"PASSWORD": _db_pass,
|
|
"HOST": _db_host,
|
|
"PORT": _db_port,
|
|
}
|
|
}
|
|
|
|
LANGUAGE_CODE = "en-us"
|
|
TIME_ZONE = "UTC"
|
|
USE_I18N = True
|
|
USE_TZ = True
|
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
|
|
# CORS
|
|
CORS_ALLOW_ALL_ORIGINS = True
|
|
|
|
# REST Framework
|
|
REST_FRAMEWORK = {
|
|
"DEFAULT_PERMISSION_CLASSES": [
|
|
"rest_framework.permissions.AllowAny",
|
|
],
|
|
}
|
|
|
|
# Static files for admin
|
|
STATIC_URL = "/static/" |