Skip to main content

Prerequisites

Before setting up the SASCOP BME SubTec project, ensure you have the following installed:
1

Python 3.8+

Verify Python installation:
python --version
2

PostgreSQL 12+

Install PostgreSQL database server. The project uses PostgreSQL as its primary database.
3

Git

For version control and cloning the repository.
4

pip

Python package manager (usually comes with Python).

Installation Steps

1

Clone the Repository

git clone <repository-url>
cd bme_subtec
2

Create Virtual Environment

Create and activate a Python virtual environment:
python -m venv venv
source venv/bin/activate
3

Install Dependencies

Install all required Python packages from requirements.txt:
pip install -r requirements.txt
This will install Django 4.2.7 and all other dependencies including PostgreSQL drivers, PDF generation libraries, and data processing tools.
4

Configure Environment Variables

Create a .env file in the project root directory:
touch .env
Add the following environment variables (see Environment Variables for complete list):
.env
# Django Settings
SECRET_KEY=your-secret-key-here
DEBUG=True

# Database Configuration
RDS_DB_NAME=sascop_local
RDS_USERNAME=postgres
RDS_PASSWORD=your-password
RDS_HOSTNAME=localhost
RDS_PORT=5432

# Email Configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=[email protected]
EMAIL_HOST_PASSWORD=your-app-password
Never commit your .env file to version control. It’s already included in .gitignore.
5

Set Up Local Database

Create a PostgreSQL database for local development:
createdb sascop_local
Or using psql:
CREATE DATABASE sascop_local;
6

Run Migrations

Apply database migrations to create all necessary tables:
python manage.py migrate
7

Create Superuser

Create an admin user to access the Django admin panel:
python manage.py createsuperuser
Follow the prompts to set username, email, and password.
8

Collect Static Files

Collect all static files for development:
python manage.py collectstatic --noinput
9

Initialize Modules

Run the custom management command to initialize system modules:
python manage.py inicializar_modulos

Verify Installation

Run the development server to verify everything is set up correctly:
python manage.py runserver
Navigate to http://localhost:8000 in your browser. You should see the SASCOP application.
The default port is 8000. To use a different port, specify it: python manage.py runserver 8080

Key Dependencies

The project uses the following major dependencies:
PackageVersionPurpose
Django4.2.7Web framework
psycopg2-binary2.9.7PostgreSQL adapter
gunicorn21.2.0WSGI HTTP server
whitenoise6.4.0Static file serving
reportlab4.0.4PDF generation
pandas2.3.3Data analysis
matplotlib3.10.8Chart generation
openpyxl3.1.5Excel file handling
django-anymail14.0Email backend
See the complete list in requirements.txt.

Troubleshooting

PostgreSQL Connection Issues

If you encounter database connection errors:
  1. Verify PostgreSQL is running:
    sudo systemctl status postgresql
    
  2. Check your database credentials in .env
  3. Ensure the database exists:
    psql -l | grep sascop_local
    

Permission Errors

If you get permission errors during installation:
pip install --user -r requirements.txt

Port Already in Use

If port 8000 is already in use:
python manage.py runserver 0.0.0.0:8080

Next Steps

Database Configuration

Learn about database settings and configuration options

Running Locally

Start developing with the local development server

Build docs developers (and LLMs) love