Overview
This page documents the URL routing configuration for the Proyecto Django application. URL patterns are defined across two files:proyecto/urls.py- Main project URL configurationCTP/urls.py- Application-specific URL patterns
re_path() to match URL patterns and route requests to the appropriate view functions.
Main URL Configuration
The main URL configuration is located atproyecto/urls.py:
proyecto/urls.py
Admin Interface
Django admin interface for database management and administration.
re_path(r'admin/', admin.site.urls)
Access the admin interface at /admin/ to manage:
- Users and permissions
- Projects, tasks, and team members
- Site configuration
You must create a superuser account to access the admin interface. See the Quickstart Guide for instructions.
Authentication URLs
Built-in Django authentication views for login, logout, password reset, etc.
re_path(r'accounts/', include('django.contrib.auth.urls'))
This includes standard authentication URLs:
/accounts/login/- User login page/accounts/logout/- User logout/accounts/password_change/- Password change form/accounts/password_reset/- Password reset flow
LOGIN_REDIRECT_URL (configured as / in settings).
Static and Media Files
Static and media files are served during development:CTP Application URLs
The main application URLs are defined inCTP/urls.py:
CTP/urls.py
Home Page
Application home page and main menu.
re_path(r'^$', menuinicial, name='inicio')View:
seguridad.menu.menuinicialName:
inicio
The root URL displays the main menu after authentication. Users can navigate to different sections from here.
Projects Management
Project management interface for creating, editing, viewing, and deleting projects.
re_path(r'Proyectos/', viewProyectos, name='Proyectos')View:
CTP.view_proyectos.viewProyectosName:
Proyectos
This URL handles all project-related operations through action parameters:
Tasks Management
Task management interface for creating, editing, viewing, and deleting tasks.
re_path(r'Tareas/', viewTareas, name='Tareas')View:
CTP.view_registros.viewTareasName:
Tareas
This URL handles all task-related operations:
Team Members Management
Team member (encargado) management interface.
re_path(r'trabajadores/', viewtrabajadores, name='trabajadores')View:
CTP.view_trabajadores.viewtrabajadoresName:
trabajadores
This URL handles all team member operations:
User Registration
Superuser account creation interface.
re_path(r'registration/', crear_superusuario, name='crear_superusuario')View:
CTP.crearusuario.crear_superusuarioName:
crear_superusuario
This URL provides a web interface for creating superuser accounts.
You can also create superusers via the command line using
python manage.py createsuperuser.URL Naming and Reverse Resolution
Django’s URL naming system allows you to reference URLs by name instead of hardcoding paths:inicio- Home pageProyectos- Projects managementTareas- Tasks managementtrabajadores- Team members managementcrear_superusuario- User registration
Action-Based URL Pattern
The application uses an action-based URL pattern where a single URL handles multiple operations via query parameters:| Action | HTTP Method | Purpose |
|---|---|---|
agregar | GET/POST | Display form (GET) or create record (POST) |
editar | GET/POST | Display form (GET) or update record (POST) |
eliminar | GET/POST | Display confirmation (GET) or delete record (POST) |
consultar | GET | Query record details via AJAX |
pdflistado | GET | Generate PDF report |
This action-based pattern keeps the URL structure simple while supporting full CRUD operations. The view function handles routing based on the
action parameter.URL Regular Expressions
The application usesre_path() with regular expressions for URL matching:
Request Flow Example
Here’s how a typical request flows through the URL configuration:Authentication Requirements
All CTP URLs require authentication via the@login_required decorator:
/accounts/login/.
See Also
- Project Views - Detailed view function documentation
- Task Views - Task view implementation
- Team Views - Team member view implementation
- Authentication Guide - Authentication system details