# ISU2 WWW Storefront



## Getting started
This application is intended to be hosted on an Alma Linux 8 machine and instructions are for running in such a context, some dependencies may have issues on other versions of linux, good luck troubleshooting.
### Installation



1. **Enter directory:**
   ```bash
   cd www
   ```
2. **Install correct version of python**
    ```bash
    sudo dnf install python38 -y
   ```

3. **Create virtual environment:**
   ```bash
   ensure you are located in /home/cdc/www/www
   python3.8 -m venv .venv
   # On Linux/Mac:
   source .venv/bin/activate
   ```

4. **Install dependencies:**
   ```bash
   sudo dnf groupinstall "Development Tools" -y
   sudo dnf install python38-devel -y
   pip install -r requirements.txt
   ```

5. **Configure the application:**
   - Settings are preconfigured for you in [app/config.py](app/config.py)


6. **Run the server:**
   ```bash
   flask run --host=0.0.0.0 --port=80
   ```

Server starts on `http://0.0.0.0:80`

## Pages
| Frontend Route | Description |
|----------------|-------------|
| /              | Home page |
| /login         | User login page |
| /register      | User registration page |
| /profile       | View tickets, manage account info, set shipping info, catch the scrat game, edit payment info, logout |
| /store      | View stock and place orders |
| /order      | View pending orders, cancel orders |
| /admin      | Perform admin stock modifications |
| /admin/flag      | Renders the admin flag |

## Competition Flags
One competition blue flag can be accesed through this application:
- `admin_flag`: Stored in the /admin/flag route

## File Structure

```
app/
├── __init__.py          # Application factory
├── auth.py              # Authentication routes and database account information
├── config.py            # Configuration settings
├── order.py             # Payment and ticket information routes
├── routes.py            # Website page routes 
└── utils/
    └── db.py                 # database interfacing functions
    └── decorators.py         # decorator functions
```
