Launch a Simple HTTP Web Server with Python in less than a minute


How to launch a Simple HTTP Web Server with Python in less than a minute



Overview

In this post we will learn how to launch the built-in-web server in Python.

What is a SimpleHTTPServer?

The SimpleHTTPServer module is an in-built web server in Python that provides standard GET and HEAD request handlers. The SimpleHTTPServer module has been merged into http.server in Python 3.

Pre-requisites:

  • A Computer
  • Python installed (If not, click here)
  • Working Internet Connection

How to start?

  1. Open Command Prompt on Windows.
  2. Press Win-Key + R and type cmd and skip step 1.
  3. In your terminal, cd into whichever directory you wish to have accessible via browsers and HTTP.
  4. Now, type python -m http.server [port] (can use the default port: 8000) and enter. Voila! Your built-in Python web server is running.
  5. Open your favorite browser and type http://localhost:8000 or http://127.0.0.1:8000
  6. If you don’t have an index.html file in the directory, then all files and directories will be listed.
  7. Check your terminal. You should see standard http logging informations. It will update as long as http server is running.
How to launch a Simple HTTP Web Server with Python in less than a minute

How to launch a Simple HTTP Web Server with Python in less than a minute

Simple and Easy-to-Launch

You don’t have to install or configure anything. The only thing you need is Python installed. This makes launching a simple web server in less than a minute. While there are many web server softwares out there (apache, nginx) but running built-in Python web server is really easy.

If this post was helpful, share this on your social circles. Comment down below if you face any issues.

Comments

Popular Posts

How to dive into programming?

Inside Data Structures and Algorithms

Stacks

How to dual-boot Kali Linux and Windows 10 in a UEFI System