81 lines
3.8 KiB
Python
81 lines
3.8 KiB
Python
"""
|
|
Django settings pour le portfolio professionnel.
|
|
Toutes les données sont chargées depuis :
|
|
- data/projects.json → liste des projets
|
|
- data/config.json → toutes les infos du site (profil, compétences, contact, etc.)
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
# ─── Chemins de base ──────────────────────────────────────────────────────────
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
# ─── Sécurité ─────────────────────────────────────────────────────────────────
|
|
SECRET_KEY = 'django-insecure-portfolio-key-change-in-production-xyz123'
|
|
DEBUG = True
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
# ─── Applications installées ──────────────────────────────────────────────────
|
|
INSTALLED_APPS = [
|
|
'django.contrib.staticfiles',
|
|
'projects', # Notre app principale
|
|
]
|
|
|
|
# ─── Middleware minimal ───────────────────────────────────────────────────────
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
]
|
|
|
|
# WhiteNoise : sert les fichiers statiques en production (Docker/Gunicorn)
|
|
# En dev local (runserver), Django gère les static automatiquement
|
|
try:
|
|
import whitenoise # noqa
|
|
MIDDLEWARE.insert(1, 'whitenoise.middleware.WhiteNoiseMiddleware')
|
|
except ImportError:
|
|
pass
|
|
|
|
# ─── URLs & WSGI ──────────────────────────────────────────────────────────────
|
|
ROOT_URLCONF = 'portfolio.urls'
|
|
WSGI_APPLICATION = 'portfolio.wsgi.application'
|
|
|
|
# ─── Templates ────────────────────────────────────────────────────────────────
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [BASE_DIR / 'templates'],
|
|
'APP_DIRS': False,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.request',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
# ─── Base de données (non utilisée, données depuis JSON) ─────────────────────
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': BASE_DIR / 'db.sqlite3',
|
|
}
|
|
}
|
|
|
|
# ─── Fichiers statiques ───────────────────────────────────────────────────────
|
|
STATIC_URL = '/static/'
|
|
STATICFILES_DIRS = [BASE_DIR / 'static']
|
|
STATIC_ROOT = BASE_DIR / 'staticfiles' # dossier cible pour collectstatic
|
|
|
|
# ─── Internationalisation ─────────────────────────────────────────────────────
|
|
LANGUAGE_CODE = 'fr-fr'
|
|
TIME_ZONE = 'Europe/Paris'
|
|
USE_I18N = False # site mono-langue, pas besoin du moteur de traduction
|
|
USE_TZ = True
|
|
|
|
# ─── Chemins vers les fichiers JSON de données ────────────────────────────────
|
|
PROJECTS_JSON_PATH = BASE_DIR / 'data' / 'projects.json'
|
|
CONFIG_JSON_PATH = BASE_DIR / 'data' / 'config.json'
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|