.gitignore añadido, login creado, fix página principal y limpieza de archivos innecesarios

This commit is contained in:
adrigongv23 2026-06-17 23:00:02 +02:00
parent d44b3c733e
commit 8afc33bc57
47 changed files with 158 additions and 16 deletions

35
.gitignore vendored Normal file
View file

@ -0,0 +1,35 @@
# Python
__pycache__/
*.py[cod]
*.pyo
*.pyd
.Python
# Virtual environment
venv/
env/
.venv/
# Django
*.sqlite3
/media/
/staticfiles/
# Environment variables
.env
.env.local
# Claude Code workspace
.claude/
# IDE
.vscode/
.idea/
*.iml
# OS
.DS_Store
Thumbs.db
# Logs
*.log

View file

@ -135,3 +135,7 @@ AUTH_USER_MODEL = 'users.CustomUser'
MEDIA_URL = '/media/' # La URL pública (ej: tudominio.com/media/archivo.pdf)
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') # La carpeta física en tu ordenador
LOGIN_URL = 'login'
LOGIN_REDIRECT_URL = 'inicio'
LOGOUT_REDIRECT_URL = 'login'

View file

@ -17,13 +17,12 @@ Including another URLconf
from django.contrib import admin
from django.urls import path
from gestion import views # Importamos las vistas de la app donde guardaste la función
from django.contrib.auth import views as auth_views
from gestion import views
urlpatterns = [
path('admin/', admin.site.urls),
# Ruta raíz: cuando entres a la web, cargará directamente nuestro Dashboard
path('', views.inicio, name='inicio'),
# Tus otras rutas de aplicaciones...
path('', views.inicio, name='inicio'),
path('login/', auth_views.LoginView.as_view(template_name='login.html'), name='login'),
path('logout/', auth_views.LogoutView.as_view(next_page='login'), name='logout'),
]

View file

@ -11,8 +11,11 @@
<link rel="stylesheet" href="{% static 'css/estilos.css' %}">
{% block extra_head %}{% endblock extra_head %}
<style>
html, body { overflow: hidden; height: 100%; }
</style>
</head>
<body class="bg-light text-dark overflow-x-hidden d-flex flex-column min-vh-100">
<body class="bg-light text-dark d-flex flex-column min-vh-100">
<nav class="navbar navbar-expand-xl navbar-dark bg-dark sticky-top shadow-sm">
<div class="container-fluid px-4">
@ -87,7 +90,7 @@
</div>
</nav>
<main class="container-fluid py-4 px-4" style="min-height: calc(100vh - 140px);">
<main class="container-fluid py-3 px-4 flex-grow-1 d-flex flex-column" style="min-height: 0;">
{% block content %}
{% endblock content %}
</main>

View file

@ -4,9 +4,9 @@
{% block title %}Inicio | Gades Manager{% endblock title %}
{% block content %}
<div class="row mb-4">
<div class="row mb-3 flex-shrink-0">
<div class="col-12">
<div class="bg-dark text-white p-4 rounded-3 shadow-sm d-flex justify-content-between align-items-center flex-wrap" style="border-left: 5px solid #0d6efd;">
<div class="bg-dark text-white p-3 rounded-3 shadow-sm d-flex justify-content-between align-items-center flex-wrap" style="border-left: 5px solid #0d6efd;">
<div>
<h1 class="display-6 fw-bold mb-1">Bienvenido, {{ user.first_name }} {{ user.last_name }}</h1>
<p class="text-white-50 mb-0">Panel de control de la plataforma de gestión interna.</p>
@ -20,12 +20,12 @@
</div>
</div>
<div class="row g-4">
<div class="col-12 col-lg-8 text-center">
<div class="shadow rounded-3 overflow-hidden">
<img src="{% static 'images/monoplaza_gades.jpg' %}" alt="Monoplaza Formula Gades" class="img-fluid rounded-3 d-block mx-auto"
style=" width: 100%; max-height: 70vh; object-fit: cover; ">
<div class="row g-4 flex-grow-1" style="min-height: 0;">
<div class="col-12 col-lg-8 d-flex flex-column" style="min-height: 0;">
<div class="shadow rounded-3 overflow-hidden flex-grow-1" style="min-height: 0;">
<img src="{% static 'images/monoplaza_gades.jpg' %}" alt="Monoplaza Formula Gades"
style="width: 100%; height: 100%; object-fit: cover; display: block;">
</div>
</div>

View file

@ -0,0 +1,101 @@
{% load static %}
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Iniciar Sesión | Formula Gades</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
html, body {
height: 100%;
overflow: hidden;
}
body {
background-color: #111;
}
.login-bg {
position: fixed;
inset: 0;
background-image: url("{% static 'images/monoplaza_gades.jpg' %}");
background-size: cover;
background-position: center;
filter: brightness(0.35);
z-index: 0;
}
.login-card {
position: relative;
z-index: 1;
background: rgba(20, 20, 20, 0.88);
border: 1px solid rgba(255,255,255,0.08);
backdrop-filter: blur(6px);
}
.form-control {
background-color: #1e1e1e;
border-color: #444;
color: #f0f0f0;
}
.form-control:focus {
background-color: #1e1e1e;
border-color: #0d6efd;
color: #f0f0f0;
box-shadow: 0 0 0 0.2rem rgba(13,110,253,.25);
}
.form-control::placeholder { color: #888; }
.form-label { color: #ccc; }
</style>
</head>
<body class="d-flex align-items-center justify-content-center min-vh-100">
<div class="login-bg"></div>
<div class="login-card rounded-4 shadow-lg p-4 p-md-5" style="width: 100%; max-width: 420px;">
<div class="text-center mb-4">
<img src="{% static 'images/logo_gades.png' %}" alt="Formula Gades" height="60" class="mb-3">
<h4 class="text-white fw-bold mb-1">Plataforma de gestión interna</h4>
<p class="text-secondary small">Bienvenido al sistema interno del equipo.</p>
</div>
{% if form.errors %}
<div class="alert alert-danger py-2 small" role="alert">
Usuario o contraseña incorrectos. Inténtalo de nuevo.
</div>
{% endif %}
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<div class="mb-3">
<label for="id_username" class="form-label fw-semibold">Usuario</label>
<input type="text" name="username" id="id_username"
class="form-control"
placeholder="Introduce tu usuario"
autofocus required>
</div>
<div class="mb-4">
<label for="id_password" class="form-label fw-semibold">Contraseña</label>
<input type="password" name="password" id="id_password"
class="form-control"
placeholder="Introduce tu contraseña"
required>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary fw-bold py-2">
Iniciar Sesión
</button>
</div>
</form>
<div class="text-center mt-3">
<a href="#" class="text-secondary small text-decoration-none">¿Olvidaste tu contraseña?</a>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>