Python: Start Python HTTP Server

By Xah Lee. Date: .

Start python builtin HTTP server

start python 3's builtin HTTP server

in terminal

cd to the dir that you want to be the webroot.

then

python -m http.server

then, visit this url

http://localhost:8000/

Stop Python HTTP Server

how to stop python HTTP server in windows powershell

on Microsoft Windows PowerShell, if the process is in current terminal, press Ctrl+c

else,

Get-Process -Name python

# or

Get-Process -Name python | Select-Object Id, ProcessName, StartTime
Stop-Process -Id 1234 -Force