This project implements a simple Student Database Management System using Python and a PostgreSQL database running in Docker.
-
Install Docker: Ensure Docker is installed and running on your system. [cite: 7]
-
Start PostgreSQL Container: Open a terminal and run the following command to start a PostgreSQL container named
pg_lab(this is slightly different from the PDF to give it a name, which is good practice).docker run --name pg_lab -e POSTGRES_PASSWORD=admin123 -p 5432:5432 -d postgres
-
Create the Database: You must create the
studentdbdatabase before running the Python program.# Get a shell inside the running container docker exec -it pg_lab psql -U postgres # Inside the psql shell, run: CREATE DATABASE studentdb; # Type \q to exit psql
-
Install Python Dependencies: Install the required
psycopg2library.pip install -r requirements.txt
To run the program, execute the main.py file from your terminal:
python main.py