4 ms·
To run a localhost webserver on port 8000, serving the content of the current directory: python -m http.server Pass -h for more options.
by pjot 2y ago
To run a localhost webserver on port 8000, serving the content of the current directory:
python -m http.server
Pass -h for more options.
- macNchz 2y agoThis is one I use all the time, super handy. Another CLI module I regularly make use of is `python -m json.tool`, for formatting and validating json. Last year I ran http.server with -h to remind myself of something, and the --cgi flag caught my eye...funnily enough there's built in support in the web server for running CGI scripts. Alas, it's deprecated and will be removed in 3.13 later this year, but I when I discovered it I couldn't resist the opportunity to write a CGI script for the first time 20-something years: https://github.com/drien/python-httpserver-upload https://github.com/drien/python-httpserver-upload
- ttyprintk 2y agoYou’ll probably like -m zipfile for those times unzip is not installed.