Home Python web server
Post
Cancel

Python web server

If we want to test a web site or share some files with another person we can have a web server running quickly with python only running one command:

  • Run a web server on the current directory:
1
$ python3 -m http.server
  • Run a web server on other directory:
1
$ python3 -m http.server --directory /other/directory
  • Run a web server on another port

Python web server listens to port 8000 by default. The default port can be overriden by passing the desired port number as argument:

1
$ python3 -m http.server 443

Enjoy! ;)

This post is licensed under CC BY 4.0 by the author.