# Parking Management System

This guide explains how to set up and run the Parking Management System on a Windows PC.

## Prerequisites

Before you begin, ensure you have the following installed:

1.  **Python 3.8+**: [Download Python](https://www.python.org/downloads/) (Make sure to check "Add Python to PATH" during installation)
2.  **SQL Server**: [Download SQL Server Express](https://www.microsoft.com/en-us/sql-server/sql-server-downloads) (or use an existing SQL Server instance)
    *   Ensure **SQL Server Authentication** is enabled.
    *   Create a database named `ParkingManagement_DB`.
    *   Create a user (default in config is `sapr3` with password `sapr3`) and give them access to the database.
3.  **ODBC Driver 17 for SQL Server**: Required for Python to talk to SQL Server. [Download here](https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server).

## Installation

1.  **Open the Project Folder**: Navigate to the folder containing these files.
2.  **Run Setup**: Double-click on `setup.bat`.
    *   This will create a virtual environment (`venv`).
    *   It will install all necessary libraries from `requirements.txt`.
    *   It will create a `.env` file if it doesn't exist.
3.  **Configure Database**:
    *   Open the `.env` file in Notepad or any text editor.
    *   Update the following lines with your SQL Server details:
        ```ini
        DB_SERVER=localhost\SQLEXPRESS  <-- Your SQL Server Name
        DB_NAME=ParkingManagement_DB    <-- Your Database Name
        DB_USER=sapr3                   <-- Your Database Username
        DB_PASSWORD=sapr3               <-- Your Database Password
        ```

## Running the Application

1.  **Start the Server**: Double-click on `run_https.bat`.
2.  **Access the App**: Open your browser and go to `https://localhost:8000`.
    *   Note: Since we are using a self-signed certificate, your browser may show a security warning. You can safely click "Advanced" -> "Proceed to localhost (unsafe)".

## Troubleshooting

-   **"Python is not recognized..."**: Reinstall Python and ensure "Add Python to PATH" is checked.
-   **Database Connection Error**:
    -   Double-check your `.env` file credentials.
    -   Ensure SQL Server is running.
    -   Ensure TCP/IP is enabled in SQL Server Configuration Manager.
