asw/archive/packs/python/README.md
exe.dev user e47a9f4401 asw-v01: archive deferred content (packs, site, lab, legacy examples)
- 2.1: packs/ -> archive/packs/
- 2.2: site/ -> archive/site/
- 2.3: src/lab/ -> archive/lab/
- 2.4: examples/ -> archive/examples-legacy/ (SSI-based)
2026-06-07 10:39:21 +02:00

1.1 KiB

ASW Python Dev Server Pack

Drop-in replacement for python -m http.server with ASW-styled error pages and directory listings.

Usage

# Copy to your project
cp asw_server.py /path/to/project/

# Run it
python asw_server.py              # port 8000
python asw_server.py 3000         # custom port
python asw_server.py 3000 /dir    # custom port + custom directory

What you get

  • ASW-styled error pages for all HTTP error codes (403, 404, 500, etc.)
  • ASW-styled directory listings replacing the browser-default autoindex
  • Auto port fallback — if 8000 is busy, tries 8001, 8002… up to 10 attempts
  • Inline styles — no external CSS dependency, works even when serving offline

How it works

ASWHandler subclasses SimpleHTTPRequestHandler and overrides:

  • send_error() — returns ASW-styled HTML instead of the default ugly page
  • list_directory() — returns a clean table layout instead of raw <pre>

Styles are inlined directly in the response — no link to asw.css required. The colour scheme matches the full ASW dark theme.

No dependencies

Just Python 3 standard library. Nothing to install.