Skip to main content
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:
AppDescription
gestorShared choices, utilities, and base configuration
usuarioAdministrador, Organizador, and Jugador profile models
equipoEquipo model
torneoTorneo, TorneoEquipo, Jornada, Eliminatoria, EliminatoriaGrupos, Clasificacion
enfrentamientoEnfrentamiento and per-match statistics models
estadisticasEstadisticasFutbol, EstadisticasBaloncesto

Internationalization

SettingValue
LANGUAGE_CODEes-es
TIME_ZONEEurope/Madrid
USE_I18NTrue
USE_TZTrue
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

SettingValue
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:
SettingDevelopment valueProduction guidance
SECRET_KEYHardcoded insecure keyGenerate a strong random key; inject via environment variable or secrets manager
DEBUGTrueSet to False
ALLOWED_HOSTS["*"]Restrict to your actual domain(s)