Using Flask as a lightweight HTTP server in place of Python's built-in http.server
Project description
simple_flask_server
A Flask equivalent of python -m http.server.
This package provides a simple HTTP server that serves files from the current directory or a specified directory, just like Python's built-in http.server module, but implemented with Flask.
Installation
It is recommended to use uv for installation.
uv tool install simple_flask_server
Alternatively, you can use pip:
pip install simple_flask_server
Usage
Run the server from the command line:
simple-flask-server [path] [options]
You can also run it as a Python module:
python -m simple_flask_server [path] [options]
Arguments
path(optional): The directory to serve files from. If not specified, it defaults to the current working directory.
Options
--bind/-b: Specify the address and port to bind to.- Format:
[address][:port] - Default:
127.0.0.1:8001
- Format:
Examples
To serve files from the current directory on the default address and port:
simple-flask-server
To serve files from a specific directory (e.g., /var/www):
simple-flask-server /var/www
To run the server on a different address and port (e.g., all interfaces on port 8080):
simple-flask-server -b 0.0.0.0:8080
Features
- Serves files from a specified directory.
- Lists directory contents if
index.htmlorindex.htmis not found. - Redirects to add a trailing slash for directories.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
Atsuo Ishimoto
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_flask_server-0.0.5.tar.gz.
File metadata
- Download URL: simple_flask_server-0.0.5.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2aab91fef395e89bcd1c6d336bd3e0dc42e7f3b037d0ddb656030359979fcece
|
|
| MD5 |
7753d18242c46e2c0cdb96b7486be0da
|
|
| BLAKE2b-256 |
f1f3cd2753b814d607181e4dd28b0b94408c66cb6167e1260c9b4fa908e30063
|
File details
Details for the file simple_flask_server-0.0.5-py3-none-any.whl.
File metadata
- Download URL: simple_flask_server-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edd9d37de2b8cfb3043dbc774eeb43c5441c673914eabf74a02571dda2a0312a
|
|
| MD5 |
754fd9ae39f3ee729f4ee6c731c291aa
|
|
| BLAKE2b-256 |
aea1f8a508fcd1b855cad77579073046eea990264a2e989f0c6c74be9fadfbb3
|