Creating a Web Framework with Python

Aleph Melo
5 min readOct 31, 2020

Yes, let’s create yet another web framework, because why not? By the end of this post, we’ll be able to use our new framework as such:

Pullo is Finnish for Flask/Bottle

Introduction

First of all, we need to understand how to talk to a web server from our Python web framework. In the early days of Python web development, there were many frameworks out there, but they had limited compatibility across different web servers. To solve that, they came up with wsgi which stands for Web Server Gateway Interface¹. Now web servers have a convenient and standard way to talk to each other, also known as an interface.

WSGI

The Web Server Gateway Interface (WSGI) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python¹.

A WSGI-compatible web server expects to receive a callable that takes two arguments. Our callable is application . The first argument is a dict , that holds the information about the incoming request. The second is another Callable responsible for setting the response code and response headers.

--

--