Skip to main content

Overview

This guide will help you quickly set up and start using Proyecto. If you’re new to Django or need detailed explanations, check out the full Installation Guide.
This quick start assumes you have Python 3.8+, PostgreSQL, and basic command-line knowledge.

Fast-Track Setup

1

Install and Setup

Clone the repository and install dependencies:
# Clone repository
git clone <repository-url>
cd proyecto

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
2

Configure Database

Create a PostgreSQL database and update settings:
# Create database
psql -U postgres -c "CREATE DATABASE Proyecto;"
Edit proyecto/settings.py with your database credentials:
proyecto/settings.py
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'Proyecto',
        'USER': 'postgres',
        'PASSWORD': 'your_password',  # Change this
        'HOST': 'localhost',
        'PORT': '5432',
        'ATOMIC_REQUESTS': True,
    }
}
Replace 'your_password' with your actual PostgreSQL password.
3

Initialize Database

Run migrations and create a superuser:
# Apply migrations
python manage.py migrate

# Create admin account
python manage.py createsuperuser
Follow the prompts to set up your admin username and password.
4

Start Development Server

Launch the development server:
python manage.py runserver
Open your browser to http://127.0.0.1:8000/
You should see the Proyecto login page. Use the superuser credentials you just created.

Using Proyecto

Once your server is running, you can start managing projects and tasks.

Accessing the System

1

Login to the Application

Navigate to http://127.0.0.1:8000/ and enter your superuser credentials.After successful login, you’ll be redirected to the main menu.
2

Access Admin Interface (Optional)

For administrative tasks, access the Django admin at:
http://127.0.0.1:8000/admin/
Here you can manage users, groups, and permissions.

Creating Your First Team Member

Before creating projects and tasks, you need to add team members (encargados).
1

Navigate to Team Members

From the main menu, click on “Encargado” or navigate to:
http://127.0.0.1:8000/trabajadores/
2

Add New Team Member

Click the “Agregar” (Add) button and fill in the form:
# Form fields based on trabajadoresForm
nombres: "John Doe"  # Team member name
The system automatically tracks:
  • Registration date (fecha_registro)
  • Registration time (hora_registro)
  • Active status (status)
3

Verify Creation

After saving, you’ll see the new team member in the list. The system validates against duplicate names.
All team members are stored in the encargado model with automatic timestamps.

Creating Your First Project

With team members added, you can now create projects.
1

Navigate to Projects

From the main menu, access the Projects section:
http://127.0.0.1:8000/Proyectos/
2

Create New Project

Click “Agregar” and fill in the project form:
# Based on ProjectForm fields
nombre_proyecto: "Website Redesign"     # Project name
lider: "John Doe"                       # Project leader (ForeignKey)
encargados: ["John Doe", "Jane Smith"]  # Team members (ManyToMany)
class Proyectos(ModeloBase):
    nombre_proyecto = models.CharField(max_length=100)
    lider = models.ForeignKey(encargado, on_delete=models.CASCADE,
                             related_name='proyectos_lider')
    encargados = models.ManyToManyField(encargado,
                                       related_name='proyectos_encargados')
3

View Project Details

After creation, your project appears in the list with:
  • Project name
  • Leader name
  • Assigned team members
  • Automatic registration timestamp
Click “Consultar” to view detailed project information via AJAX.

Creating Your First Task

Tasks are assigned to individual team members.
1

Navigate to Tasks

Access the Tasks section:
http://127.0.0.1:8000/Tareas/
2

Add New Task

Click “Agregar” and complete the task form:
# Based on TareasForm fields
nombre_tarea: "Design homepage mockup"  # Task name
encargados: "John Doe"                  # Assigned team member
The task model structure:
CTP/models.py
class Tareas(ModeloBase):
    nombre_tarea = models.CharField(max_length=100)
    encargados = models.ForeignKey(encargado, on_delete=models.CASCADE)
3

Manage Tasks

From the task list, you can:
  • View: See all active tasks
  • Edit: Modify task details
  • Delete: Soft-delete tasks (sets status=False)
  • Export: Generate PDF reports
Tasks use soft deletion - they’re marked as inactive rather than permanently removed.

Key Features in Action

Transaction Safety

All create, update, and delete operations use Django’s atomic transactions:
CTP/view_proyectos.py
from django.db import transaction

@login_required
def viewProyectos(request):
    if action == 'agregar':
        with transaction.atomic():
            try:
                # Validate unique name
                if Proyectos.objects.filter(
                    nombre_proyecto=request.POST['nombre_proyecto']
                ).exists():
                    messages.error(request, 'El nombre está repetido')
                    return redirect('{}?action=agregar'.format(request.path))
                
                # Create project
                form = ProjectForm(request.POST)
                if form.is_valid():
                    proyecto = form.save()
                    messages.success(request, 'Proyecto Guardado Correctamente')
            except Exception as ex:
                messages.error(request, ex)
Atomic transactions ensure data consistency - either all changes succeed or none are applied.

PDF Report Generation

Generate PDF reports for projects, tasks, and team members:
# URL: /Proyectos/?action=pdflistado
if action == 'pdflistado':
    proyectos = Proyectos.objects.filter(status=True).order_by(
        'nombre_proyecto', 'lider'
    )
    data['listado'] = []
    for proyecto in proyectos:
        encargados = [e.nombres for e in proyecto.encargados.all()]
        data['listado'].append({
            'nombre_proyecto': proyecto.nombre_proyecto,
            'lider': proyecto.lider.nombres,
            'encargados': encargados
        })
    return render(request, 'pdf/Proyectos/listadoP.html', data)

Authentication & Security

All main views require authentication:
from django.contrib.auth.decorators import login_required

@login_required
def viewProyectos(request):
    # Only authenticated users can access
    pass

@login_required
def viewTareas(request):
    # Protected view
    pass
Session timeout is set to 5 minutes by default. Adjust SESSION_COOKIE_AGE in settings.py for different durations.

URL Structure

Proyecto uses the following URL patterns:
CTP/urls.py
urlpatterns = [
    re_path(r'^$', menuinicial, name='inicio'),
    re_path(r'Tareas/', viewTareas, name='Tareas'),
    re_path(r'trabajadores/', viewtrabajadores, name='trabajadores'),
    re_path(r'Proyectos/', viewProyectos, name='Proyectos'),
    re_path(r'registration/', crear_superusuario, name='crear_superusuario'),
]

Common URL Patterns

  • List: /Proyectos/
  • Add: /Proyectos/?action=agregar
  • Edit: /Proyectos/?action=editar&id=1
  • Delete: /Proyectos/?action=eliminar&id=1
  • PDF: /Proyectos/?action=pdflistado
  • List: /Tareas/
  • Add: /Tareas/?action=agregar
  • Edit: /Tareas/?action=editar&id=1
  • Delete: /Tareas/?action=eliminar&id=1
  • PDF: /Tareas/?action=pdflistado
  • List: /trabajadores/
  • Add: /trabajadores/?action=agregar
  • Edit: /trabajadores/?action=editar&id=1
  • Delete: /trabajadores/?action=eliminar&id=1
  • PDF: /trabajadores/?action=pdflistado

Configuration Tips

Development vs Production

# proyecto/settings.py
DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1', 'localhost']

# Use during development for detailed error pages

Database Connection

The database configuration supports atomic requests for data integrity:
proyecto/settings.py
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'Proyecto',
        'USER': 'postgres',
        'PASSWORD': 'your_password',
        'HOST': 'localhost',
        'PORT': '5432',
        'ATOMIC_REQUESTS': True,  # Ensures transaction safety
    }
}
ATOMIC_REQUESTS=True wraps each view in a database transaction, ensuring data consistency.

Common Operations

Managing Data

# Backup database
pg_dump -U postgres Proyecto > backup.sql

# Restore database
psql -U postgres Proyecto < backup.sql

Next Steps

Now that you have Proyecto running:

Explore Data Models

Learn about the database models and structure

Core Features

Explore project management features

Deploy to Production

Deploy Proyecto to a production environment

View Workflow Guide

Learn the complete project management workflow

Troubleshooting

Check that:
  • Virtual environment is activated
  • All dependencies are installed
  • Database is running and accessible
  • Port 8000 is not in use
# Check port usage
lsof -i :8000  # macOS/Linux
netstat -ano | findstr :8000  # Windows
Verify superuser was created:
python manage.py createsuperuser
Reset password if needed:
python manage.py changepassword <username>
Ensure PostgreSQL is running and credentials are correct:
# Test connection
psql -U postgres -d Proyecto

# Verify migrations
python manage.py showmigrations
For more detailed help, see the Installation Guide or check the development documentation.

Build docs developers (and LLMs) love