๐Ÿง‘โ€๐Ÿณ webchef.py

Welcome to webchef.py โ€“ a deliciously simple and lightweight HTTP server written in Python! It's designed to help you quickly serve local files from any directory, perfect for testing web projects, sharing documents, or just getting a taste of how web servers work.

Think of it as your personal kitchen assistant, ready to whip up web pages on demand!


โœจ Features

This section highlights the core capabilities and convenient functionalities that `webchef.py` offers, making it a versatile tool for your local web serving needs.


๐Ÿš€ Getting Started: Setting Up Your Kitchen

This guide provides all the necessary steps to prepare your system and get `webchef.py` installed, ensuring you have all the prerequisites in place before you start serving content.

Prerequisites

Make sure you have these ingredients before you start cooking:

Installation

Follow these steps to get `webchef.py` up and running:

  1. Download `webchef.py`:

    Grab the `webchef.py` file from this repository. You can clone the repo or simply download the file directly.

    git clone https://github.com/your-username/webchef.py.git # Replace with your actual repo URL
    cd webchef.py

    Or, if you just have the code, simply save it into a file named `webchef.py`.

  2. No extra `pip` installs needed for `webchef.py` itself! It uses only standard Python libraries.

๐Ÿ‘จโ€๐Ÿณ How to Use webchef.py

This section provides a step-by-step guide on how to operate `webchef.py`, from starting the server to understanding its automatic indexing feature and gracefully shutting it down.

  1. Go to Your Serving Directory:

    Open your terminal or command prompt and navigate to the folder you want to serve. This is your "kitchen" for `webchef.py`.

    cd /path/to/your/awesome/project
  2. Start the Server:

    Run the `webchef.py` script:

    python3 webchef.py

    (If `python3` doesn't work, try python webchef.py).

    You'll see a friendly message like:

    โœจ webchef.py is cooking! Serving on http://127.0.0.1:8080
    ๐Ÿก Your kitchen (root directory): /path/to/your/awesome/project
  3. Visit Your Web Page:

    Open your favorite web browser and go to the address shown in the terminal (e.g., http://127.0.0.1:8080).

    • If you have an `index.html` in that folder, `webchef.py` will serve it.
    • If not, it will automatically generate a lovely dark-themed index page listing all files and subfolders!

๐Ÿ“„ Automatic Index Pages (The Recipe Book Feature!)

`webchef.py` is smart! If you navigate to a directory (like http://127.0.0.1:8080/my_subfolder/) and there's no `index.html` inside, `webchef.py` will temporarily create one for you. This page will list all the files and subdirectories within that specific folder, making navigation a breeze.

Important: These auto-generated `index.html` files are temporary! They are automatically deleted when you stop the `webchef.py` server. Your original files remain untouched.

๐Ÿ›‘ Stopping the Server (Closing the Kitchen)

To stop `webchef.py`, simply go back to the terminal where it's running and press Ctrl+C (or Cmd+C on macOS).

You'll then receive your webchef.py Receipt, detailing how long your server was running and how many dishes (requests) it served!