Architecture Overview
The School_Library project is a full-featured, monolithic web application built to digitize and automate a school library's operations (ACLC Library). It handles the end-to-end lifecycle of library logistics, including cataloging inventory, managing student reservations, issuing loans, and assessing fines.
- Framework & Pattern: Built on Django 4.1.5 using the robust MVT (Model-View-Template) architectural pattern.
- Database Strategy: Configured dynamically to use SQLite for rapid local development and PostgreSQL (via
psycopg2-binary) for production. - Deployment: The application is strictly containerized using Docker and
docker-compose, orchestrating a Python 3.10 environment running the Gunicorn WSGI server alongside an Alpine-based PostgreSQL database.
Engineering Challenges Solved
Automated Cataloging via Computer Vision
Manual data entry for hundreds of books is highly tedious and error-prone. To solve this, I engineered a custom barcode scanning pipeline within the bookscraper app. By uploading an image of a book's barcode, the system uses OpenCV, Pillow, and pyzbar to decode the ISBN. It then dynamically queries the Google Books API to fetch rich metadata—title, authors, publisher, publication date, and cover thumbnail—automatically prepopulating the database.
Concurrency in Inventory Management
Managing exact copy counts and preventing double-booking of scarce books is a critical race-condition problem. The Loan and Book models leverage overridden save() methods and Django Signals to strictly manage inventory. When a loan is issued or returned, the system automatically adjusts the available_copies. If a book's available copies reach zero, its is_available flag is automatically toggled to False, explicitly blocking further reservation attempts and raising a ValidationError on concurrent hits.
Automated Notification Lifecycle
To keep students informed about their reservation statuses without manual librarian intervention, a structured Reservation model tracks states (Pending, Confirmed, Active, Cancelled). State transitions trigger HTML-templated emails via Django's built-in SMTP utilities to alert users immediately of confirmations or cancellations.
Advanced Search and UX
A SearchBooksListView leverages Django ORM's Q objects to provide a powerful, multi-faceted search across book titles, authors, and descriptions. For the librarian backend, I utilized django-material-admin to inject Google's Material Design into the standard Django admin panel, creating a highly polished, non-technical-friendly interface.
Outcomes
This capstone project showcases the power of bridging traditional CRUD web applications with automation tools (OpenCV/APIs) to solve real-world logistical bottlenecks. It transformed a purely manual, paper-based library into a digitized, auto-cataloging system.