Serve a directory over HTTP

Serve the current directory over HTTP on port 8080 with a built-in module

python3 -m http.server 8080

tool
python15 commands
tags
python

More python commands

  • python3 -m json.tool < input.json

    Pretty-print a JSON file with the standard library

  • python3 -m cProfile -s cumulative script.py | head -30

    CPU profile sorted by cumulative time

  • python3 -m pdb script.py

    Run a script under the Python debugger

  • breakpoint() # Python 3.7+ — drops into pdb at this line

    Built-in breakpoint() works like import pdb; pdb.set_trace()

  • pytest -x -v --tb=short tests/

    Stop at the first failure, with verbose output and short tracebacks

all 15 python commands