How making a website with Python works


Before making something more attractive instead of just a webpage with plain text, let’s first make sure you understand how generating websites with Python works.

Think about the user typing in your website URL in their browser.

When the user enters the URL in the browser, they are making a request to the web server.

As a developer, you would have to write some Python code to handle requests and deal with CGI which is a standard environment that Python and other web development programming languages use to create web pages dynamically. And you would have to write the same code over and over again for every web app that you built.

Now, because that is a repetitive task, someone put all that code together and created a bunch of Python files. These bunch of files were called flask. So, flask is a framework which when loaded in Python automatically executes the routine code and let’s you focus on the specific parts of your website. When we type in pip install flask in the command line, we are downloading the flask framework from its online repositories and when we import flask we are making the framework available in our current script and we can use its features easily there.

Now, before making a more advanced website, let’s go and explain all the lines of the code we have so far in the next lesson of the tutorial.


Leave a comment

Your email address will not be published. Required fields are marked *