How many of you know Python has a built-in http server ?

Susan Sarandon
Release: 2024-10-03 16:10:03
Original
614 people have browsed it

How many of you know Python has a built-in http server ?

Python has a built-in HTTP server!

You don’t need to install or configure anything to quickly spin up a simple web server in Python. It comes with a built-in HTTP server, perfect for quick testing or file sharing on your local network.

With just a single command, you can serve files from any directory:

python -m http.server
Copy after login

By default, this starts a server on port 8000, and you can access it by visiting http://localhost:8000 in your browser. You can also specify a different port, like this:

python -m http.server 8080
Copy after login

This is a super handy tool for quick file serving, development, or testing static websites without needing complex web server setups!

Oliver | Graphpe | Tutorials

The above is the detailed content of How many of you know Python has a built-in http server ?. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template