This page covers the settings in config/settings.py that an operator or deployer needs to know about. Internal Django plumbing (middleware order, template loaders, etc.) is omitted.
Gestor de Torneos is a Django 5.1 application.
Database
The application uses MySQL via the mysqlclient driver (django.db.backends.mysql). All connection parameters are read from environment variables with development defaults:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": os.getenv("DB_NAME", "tfg"),
"USER": os.getenv("DB_USER", "tfg"),
"PASSWORD": os.getenv("DB_PASSWORD", "tfg"),
"HOST": os.getenv("DB_HOST", "db"),
"PORT": os.getenv("DB_PORT", "3306"),
"OPTIONS": {
"charset": "utf8mb4",
},
}
}
The utf8mb4 charset is required to store the full Unicode character set, including emoji and non-BMP characters.
See Environment variables for all supported variables and their defaults.
Installed apps
Beyond the standard Django contrib apps, the following project apps are registered:
| App | Description |
|---|
gestor | Shared choices, utilities, and base configuration |
usuario | Administrador, Organizador, and Jugador profile models |
equipo | Equipo model |
torneo | Torneo, TorneoEquipo, Jornada, Eliminatoria, EliminatoriaGrupos, Clasificacion |
enfrentamiento | Enfrentamiento and per-match statistics models |
estadisticas | EstadisticasFutbol, EstadisticasBaloncesto |
Internationalization
| Setting | Value |
|---|
LANGUAGE_CODE | es-es |
TIME_ZONE | Europe/Madrid |
USE_I18N | True |
USE_TZ | True |
Two languages are enabled:
LANGUAGES = [
('es', 'Español'),
('en', 'English'),
]
Translation files (.po / .mo) are expected under BASE_DIR / 'locale':
LOCALE_PATHS = [
BASE_DIR / 'locale',
]
The LocaleMiddleware is active, so the active language is negotiated per request from the Accept-Language header or a language cookie.
Static files
| Setting | Value |
|---|
STATIC_URL | /static/ |
STATICFILES_DIRS | [BASE_DIR / 'static'] |
The project-level static/ directory is the only configured static-files source. Run python manage.py collectstatic before deploying behind a production web server.
Authentication
Django’s built-in authentication system (django.contrib.auth) is used without customization. The AUTH_USER_MODEL is the default auth.User. Role-specific data is stored in the profile models (Administrador, Organizador, Equipo, Jugador) via OneToOneField relationships.
The following password validators are active:
UserAttributeSimilarityValidator
MinimumLengthValidator
CommonPasswordValidator
NumericPasswordValidator
Production checklist
The following defaults in config/settings.py are not safe for production. Change them before going live:
| Setting | Development value | Production guidance |
|---|
SECRET_KEY | Hardcoded insecure key | Generate a strong random key; inject via environment variable or secrets manager |
DEBUG | True | Set to False |
ALLOWED_HOSTS | ["*"] | Restrict to your actual domain(s) |