Software engineer in the making week 2.0.. Understanding Linux.. Localhost.1934

Serverless Functions: Your Website's New Best Friend

Lets' explore the concept of localhost focusing on running a Python local host and accessing it through a web browser.

So you own a private playground where you cook things and prepare for competitions, learn and perfect new skills. that is a localhost. it is a Tiny internet within your computer. Just call it your own computer. When you run a local server, you're creating a miniature environment to test your applications without affecting the internet version. you don't need internet connection to localhost .

Localhost refers to the local web server running on your machine, enabling you to develop and test websites locally before deploying them to the world wide web.

with this understanding lets run a python Localhost

  1. Ensure Python is installed on your machine. You can download the latest version from the official Python website.

    to be sure you have it installed use the command python --version

  2. Open a Terminal : Navigate to the directory where your project is located.

  3. Create a Simple Server: Use the following command to start a basic server:

    python -m http.server

    This command creates a server on port 8000 by default. take note of the word port.. you will need it a lot.

  4. Accessing Localhost on Web Browser: Open your web browser and type the following URL:

    http://localhost:8000

    You can customize port numbers by adding four digits after http.server

    That is it for now with Local Host in the future i will write about how to use Localhost , check your logs etc.

You can now close your terminal to stop it or CRTL C