← back to blog

Python HTTP Server

2025-10-27

Python Web

I can't believe I've gone so long as a programmer without knowing how easy it is to spin up a local server with Python.

python3 -m http.server

That's it. That's the whole command. It starts a server on port 8000 serving the current directory. No installation, no configuration, no npm packages, no nothing. It's just... there.

All those times I was testing static HTML files, opening them directly with file:// URLs and running into CORS issues. All those times I could have just run this one simple command.

Sometimes the best tools are the ones that have been sitting in your toolbox the whole time.