Application Django du BDE, avec :
- front public (
showcase) - espace membres (
members) - administration Django (URL configurable)
- authentification OIDC (
mozilla-django-oidc) - base de données MySQL/MariaDB
- Python 3.12
- Django 5.2
- MySQL/MariaDB (
mysqlclient) - Gunicorn
- Docker + Docker Compose
- Python 3.12+
- MySQL ou MariaDB en local
- Outils de compilation (Linux) :
build-essential,pkg-config,default-libmysqlclient-dev
- Docker
- Docker Compose (plugin
docker compose) - Une base MySQL/MariaDB accessible depuis le conteneur web
Important : le
docker-compose.yamlactuel ne démarre que le service web. La base est attendue sur l'hôte viahost.docker.internal:3306.
Copier l'exemple :
cp .env.example .envVariables principales :
DEBUG=True
DEV_MODE=True
SECRET_KEY=change-me
ADMIN_URL=admin/
ALLOWED_HOSTS=localhost,127.0.0.1
CSRF_TRUSTED_ORIGINS=http://localhost:8000,http://127.0.0.1:8000
CSRF_COOKIE_SECURE=False
SESSION_COOKIE_SECURE=False
DB_NAME=bde
DB_USER=bdeuser
DB_PASSWORD=your_password
DB_HOST=127.0.0.1
DB_PORT=3306
# OIDC (optionnel en local selon votre besoin)
OIDC_OP_AUTHORIZATION_ENDPOINT=
OIDC_OP_TOKEN_ENDPOINT=
OIDC_OP_USER_ENDPOINT=
OIDC_OP_JWKS_ENDPOINT=
OIDC_RP_CLIENT_ID=
OIDC_RP_CLIENT_SECRET=
OIDC_RP_SIGN_ALGO=RS256
OIDC_RP_SCOPES=openid email profileDans la table Setting, les paramètres suivants peuvent être renseignés:
google_calendar_src: liensrcpour l'iFrame Google Calendar de la page/events(affiché si renseigné)google_calendar_mode: configuration du mode de l'iFrame Google Calendar de la page/events(WEEK,MONTH...)
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txtCREATE DATABASE bde CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'bdeuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON bde.* TO 'bdeuser'@'localhost';
FLUSH PRIVILEGES;python manage.py migrate
python -m bde.generate_robots
python manage.py createsuperuser
python manage.py runserverApplication disponible sur http://127.0.0.1:8000.
Pour la stack Docker actuelle, la base doit être joignable depuis le conteneur sur l'hôte :
DB_HOST=host.docker.internal
DB_PORT=3306docker compose up --buildLe conteneur exécute automatiquement :
python manage.py migratepython -m bde.generate_robotsgunicorn bde.wsgi:application --bind 0.0.0.0:8000
docker compose downdocker build -t bde-app:0.1 .
docker run -p 8000:8000 --env-file .env --add-host=host.docker.internal:host-gateway bde-app:0.1# tests
python manage.py test
# lint/type-check
pylint bde members showcase auth utils
mypy .
# logs Docker
docker compose logs -f webbde/: configuration Django (settings, urls, env)showcase/: pages publiquesmembers/: pages et données membresauth/: backend OIDC personnalisétemplates/,static/,uploads/: assets et médias
ADMIN_URLest configurable via.env(ex:admin/,secret-admin/).- Le fichier
robots.txtest généré automatiquement au démarrage (bde.generate_robots). - En
DEBUG=True, les médias (/uploads/) sont servis par Django.