How sai060105/moviebooking works
This is a monolithic Django web application (“moviebooking” project + single “core” app) that implements a multi-theater movie ticket booking platform with:
• User auth (register/login)
• Movie catalog (posters, trailer link)
• Show scheduling (incl. automated show creation)
• Seat inventory + real-time availability
• Multi-tier pricing (SeatClass + ShowPrice)
• Booking + payment flow (template Payment.html)
• Admin dashboard (Django admin)
• Automation via signals and middleware
• Management command to import movie data
Entry points / runtime
• manage.py — CLI entry for dev server, migrations, management commands.
• moviebooking/settings.py — configuration (DB, middleware, installed apps, static/media).
• moviebooking/urls.py — root URL routing.
• moviebooking/wsgi.py / moviebooking/asgi.py — deployment entrypoints.
Core domain app (most logic lives here)
• core/models.py — domain model (Movies, Theaters, Shows, Seats, SeatClass, ShowPrice, Booking, UserProfile, etc. inferred from migrations).
• core/views.py — request handlers for home, auth, booking, payment, confirmation.
• core/urls.py — app-level routing.
• core/forms.py — server-side form validation/binding for auth/booking flows.
• core/admin.py — admin management UI for staff.
• core/templates/core/*.html — server-rendered UI pages.
• core/static/core/... — JS/CSS driving interactive seat selection and UI behavior.
Automation / background-ish behavior
• core/signals.py — event-driven automation on model changes (“data synchronization through signal handlers” per README).
• core/middleware/auto_create_shows.py — request-time automation (important to call out because it’s “hidden” behavior).
• core/management/commands/import_movies.py — offline/batch ingestion.
Persistence
• db.sqlite3 — SQLite database (single-node, local file DB in this repo).
• media/posters — uploaded/static-like assets (movie posters) served via Django media settings.
Seat availability & booking consistency (core business flow)
• Seat availability query: Views read Show + Seat(+ Booking) state from DB.
• Seat selection submission: Views attempt to create Booking and associate seats.
• Pricing: Views compute price using SeatClass + ShowPrice (and default price migrations suggest fallback).
• If the system has “real-time seat availability”, call it out as:
Automation flows (often omitted, but essential here)
• Middleware → ORM/Models → SQLite
• auto_create_shows.py might create shows if missing (request-time side effects).
• Signals (model events) → ORM/Models → SQLite
• Management Command (import_movies.py) → ORM/Models → SQLite
• offline ingestion populating Movie catalog (+ posters/trailer links)
Architectural patterns/design principles evident from repo
• Django MTV (Model–Template–View):
• Models: core/models.py
• Views: core/views.py
• Templates: core/templates/...
• Monolith with internal modular boundaries (single deployable unit)
• Event-driven side effects via signals
• Request pipeline customization via middleware
• Server-rendered UI + progressive enhancement (templates + JS/CSS)
Browser ↔ Django App ↔ SQLite + Media (+ optional Payment Gateway)
• This answers “what runs where” and “how it talks”.
Router → Views → (Forms, Templates, Models/ORM) + (Middleware, Signals, Admin, Import Command)
• This answers “where the logic is” and “what changes state automatically”.
This project benefits heavily from explicitly drawing middleware/signals/management commands, because those are the parts most likely to be missed yet materially affect behavior and data consistency.