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!
This section highlights the core capabilities and convenient functionalities that `webchef.py` offers, making it a versatile tool for your local web serving needs.
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.
Make sure you have these ingredients before you start cooking:
python3 --version
Follow these steps to get `webchef.py` up and running:
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`.
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.
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
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
Open your favorite web browser and go to the address shown in the terminal (e.g., http://127.0.0.1:8080).
`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.
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!