Skip to main content

Using Flask as a lightweight HTTP server in place of Python's built-in http.server

Project description

simple_flask_server

PyPI version License: MIT

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

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.html or index.htm is 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

simple_flask_server-0.0.5.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_flask_server-0.0.5-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

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

Hashes for simple_flask_server-0.0.5.tar.gz
Algorithm Hash digest
SHA256 2aab91fef395e89bcd1c6d336bd3e0dc42e7f3b037d0ddb656030359979fcece
MD5 7753d18242c46e2c0cdb96b7486be0da
BLAKE2b-256 f1f3cd2753b814d607181e4dd28b0b94408c66cb6167e1260c9b4fa908e30063

See more details on using hashes here.

File details

Details for the file simple_flask_server-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_flask_server-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 edd9d37de2b8cfb3043dbc774eeb43c5441c673914eabf74a02571dda2a0312a
MD5 754fd9ae39f3ee729f4ee6c731c291aa
BLAKE2b-256 aea1f8a508fcd1b855cad77579073046eea990264a2e989f0c6c74be9fadfbb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page