Initial commit
This commit is contained in:
0
portfolio/__init__.py
Normal file
0
portfolio/__init__.py
Normal file
80
portfolio/settings.py
Normal file
80
portfolio/settings.py
Normal file
@@ -0,0 +1,80 @@
|
||||
"""
|
||||
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'
|
||||
10
portfolio/urls.py
Normal file
10
portfolio/urls.py
Normal file
@@ -0,0 +1,10 @@
|
||||
"""
|
||||
URLs principales du portfolio.
|
||||
"""
|
||||
from django.urls import path, include
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('projects.urls')),
|
||||
] + static(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS[0])
|
||||
9
portfolio/wsgi.py
Normal file
9
portfolio/wsgi.py
Normal file
@@ -0,0 +1,9 @@
|
||||
"""
|
||||
WSGI config pour le portfolio.
|
||||
"""
|
||||
import os
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'portfolio.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
Reference in New Issue
Block a user