How to spin a quick and simple webserver on Mac OS using Python3

  Suhas Talekar

If you need a simple web server to test your local website on a MacOS using python, you can use the http module and spin up a quick server to test your site. Below are the steps to do it.

Steps

  1. Open terminal

  2. Navigate to the folder which you desire to host

  3. Use the below command with the specific port number

      python3 -m http.server 9000
    

Example

If I have all my web files hosted in a folder call itbusinesshub, I would navigate to that folder using the terminal and use python's http.server module to host the files at port 9000.

The server then can be accessed at localhost:9000.

If you find this helpful, please consider sharing this post. :)


Would you like to follow my posts on LinkedIn?